Lynn_AccessUser
Registered User.
- Local time
- Today, 10:27
- Joined
- Feb 4, 2003
- Messages
- 125
I have code that creates 3 tables by linking to 3 .txt files. What I would like to do is check that all 3 tables were created.
This is what I have so far:
Dim db As Database
Dim tbl1 As TableDef
Dim tbl2 As TableDef
Dim tbl3 As TableDef
Set db = CurrentDb
Set tbl1 = db.CreateTableDef("table1")
Set tbl2 = db.CreateTableDef("table2")
Set tbl3 = db.CreateTableDef("table3")
For Each tbl1 In db.TableDefs
If tbl1.Name <> "table1" Or tbl2.Name <> "table2" Or tbl3.Name <> "table3" Then
MsgBox "Error Message"
Exit Sub
Else
MsgBox "All Files Were Linked"
Exit Sub
End If
Next
This is what I have so far:
Dim db As Database
Dim tbl1 As TableDef
Dim tbl2 As TableDef
Dim tbl3 As TableDef
Set db = CurrentDb
Set tbl1 = db.CreateTableDef("table1")
Set tbl2 = db.CreateTableDef("table2")
Set tbl3 = db.CreateTableDef("table3")
For Each tbl1 In db.TableDefs
If tbl1.Name <> "table1" Or tbl2.Name <> "table2" Or tbl3.Name <> "table3" Then
MsgBox "Error Message"
Exit Sub
Else
MsgBox "All Files Were Linked"
Exit Sub
End If
Next