Hi all. I got a access vba 2000 code that i hardly understand what some of its part doing.
i need to learn this since i want to learn how to refrence these system tables.
I be happy if some expert explain to me what these part does.Thanks
part1:
part2:Code:Set rsMetadb = MetaDB.OpenRecordset("SysKeys")
part3:Code:For Each idx In tbl.Indexes bUpdate = False rsMetadb.AddNew rsMetadb("Tablename") = tbl.Name If idx.Primary = True Or idx.Unique = True Then rsMetadb("Keyname") = idx.Name
part4:Code:If bUpdate Then rsMetadb.Update
complete code:Code:rsMetadb("Keytype") = "PRIMARY"
Code:Dim bUpdate, ref As String Dim i As Integer Set rsMetadb = MetaDB.OpenRecordset("SysKeys") For Each tbl In db.TableDefs If Left(tbl.Name, 4) <> "MSys" Then For Each idx In tbl.Indexes bUpdate = False rsMetadb.AddNew rsMetadb("Tablename") = tbl.Name If idx.Primary = True Or idx.Unique = True Then rsMetadb("Keyname") = idx.Name 'Check primary key If idx.Primary = True Then rsMetadb("Keytype") = "PRIMARY" bUpdate = True Else 'Check Alternate key If idx.Unique = True And idx.Primary = False And idx.Foreign = False Then rsMetadb("Keytype") = "ALTERNATIVE" bUpdate = True End If End If If bUpdate Then rsMetadb.Update Next idx End If Next tbl rsMetadb.Close


Reply With Quote