|
-
Jun 4th, 2000, 10:08 AM
#1
Thread Starter
New Member
Is there a function in DAO 3.51 that checks whether a certain table name exist in a database (MDB) file without looping at each table?
Please help.
jade
-
Jun 4th, 2000, 08:12 PM
#2
Fanatic Member
You can use a sql statment and use one of the hidden tables in access (MSysObjects)
eg. "SELECT name FROM MSysObjects WHERE name = '" & your table & "'"
This will return any objects that are in your database.
Hope this helps
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Jun 6th, 2000, 12:28 AM
#3
PowerPoster
TableDefs
How about the TableDefs?
Code:
Private Form_Load()
Dim z%
Dim MyDb As DAO.Database
Set MyDb = DBEngine.WorkSpace(0).OpenDatabase("<Your Database.",False,False)
'Set AllTableDefs to definitions of all tables in the database:
Set AllTableDefs = MyDb.TableDefs
"Check for Table
For z = 0 To AllTableDefs.Count - 1
If StrComp(AllTableDefs(z).Name,"<Your Table Name.",vbBinaryCompare) = 0 then
Msgbox "Table Found!",vbInformation + vbOkOnly
Exit Sub
Next
End Sub
-
Jun 7th, 2000, 02:45 PM
#4
Thread Starter
New Member
Thanks Ianpbaker.
It worked. Again thanks a lot.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|