does table exist in a linked db

L

LGarcia

Hi all,
How would I check to see if a table exists in a linked db? I also need to
see if I can return the date the table was created as well.
Thanks,
LGarcia
 
E

Ed

Public Sub testt()
Dim db As Database
Dim tdfNew As TableDef

'Linked database
Set db = DBEngine.Workspaces(0).OpenDatabase("m:\db2.mdb")

For Each tdfNew In db.TableDefs
'Name opf table
If tdfNew.Name = "tblSpecialCase" Then
Debug.Print tdfNew.Name & "-" & tdfNew.DateCreated
Else
Debug.Print tdfNew.Name
End If
Next

End Sub
 
L

LGarcia

Thanks Ed,
The only problem I have is that the linked db is not static. My main db
contains forms and queries that are linked to different dbs containing data.
Is there a way to evaluate the current linked db and apply it to your code?
Thanks again for the quick reply.
LGarcia
 
E

Ed

Substitute
Set db = DBEngine.Workspaces(0).OpenDatabase("m:\db2.mdb")
with
set db = CurrentDb

ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top