Hi guys i wrote a vba code that supposed to
go find all non system tables in access 2000 db
and generate corresponded create table statements for them.
Unfortunately when i run the program it misses one of the
tables called committee members and also uses one of
table names 2 time.Furthermore, instead of using table names it
uses first columns of each table in generating table name for createing table statement.
I be happy if some expert help me fix this bug in my vba program.Thanks
http://i5.photobucket.com/albums/y18...tenissvba1.jpg ( teniss club db reletions )
http://i5.photobucket.com/albums/y18...tementvba2.jpg (genrated create table statements)
Code:
Private Sub CreateTableButton_Click()
Dim T As TableDef
Dim db As Database, cont As String
Set db = CurrentDb()
For Each T In db.TableDefs
If Left(T.Name, 4) <> "MSys" Then
' 'If T.Name = Me.ComboBox Then
pk = Left(GetPK(T, db), InStr(1, GetPK(T, db), "<-") - 1)
cont = cont & ShowFields(T.Name) & vbCrLf & " primary key " & pk & vbCrLf & vbCrLf
''MsgBox ShowFields(T.Name) & vbCrLf & " primary key " & pk & vbCrLf & vbCrLf
''End If
End If
Next T
MsgBox cont
Call createTextFile("C:\createTableStatements.txt", cont)
End Sub