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:
part3:
part4:
complete code:
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:
Code:
Set rsMetadb = MetaDB.OpenRecordset("SysKeys")
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
Code:
If bUpdate Then rsMetadb.Update
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