I have this code which I have adapted from the microsoft website, basically this should put all the tables names in one listbox and all field names in another. The table names work but the Field names doesn,t. I'm not quite sure what I'm doing wrong, the code doesn't error, but when I put the mouse over the fs.Name on the line...
strFName = fs.Name
It comes up with "Object Variable or With Block Variable Not Set"
Code Below...
Any Ideas?
Cheers
Sam
Dim db As Database 'Database to import
Dim td As TableDef 'Tabledefs in db
Dim fs As Field 'Fields In TabelDefs
Set db = DBEngine.Workspaces(0).OpenDatabase(strPath, True)
For Each td In db.TableDefs
strTDef = td.Name
If Left(strTDef, 4) <> "MSys" Then
Me.LstTable.AddItem strTDef
For Each fs In td.Fields
strFName = fs.Name
Me.LstField.AddItem strFName
Next fs
"You couldn't fool your mother on the foolingest day of your life if you had an electrified fooling machine." - Homer
strFName = fs.Name
It comes up with "Object Variable or With Block Variable Not Set"
Code Below...
Any Ideas?
Cheers
Sam
Dim db As Database 'Database to import
Dim td As TableDef 'Tabledefs in db
Dim fs As Field 'Fields In TabelDefs
Set db = DBEngine.Workspaces(0).OpenDatabase(strPath, True)
For Each td In db.TableDefs
strTDef = td.Name
If Left(strTDef, 4) <> "MSys" Then
Me.LstTable.AddItem strTDef
For Each fs In td.Fields
strFName = fs.Name
Me.LstField.AddItem strFName
Next fs
"You couldn't fool your mother on the foolingest day of your life if you had an electrified fooling machine." - Homer