Check table exists or not

J

Jason

Dear all,

Could anyone tell me how to check the table exists or not in access.

Thanks,
Jason.
 
N

Nikos Yannacopoulos

Jason,

Use function:

DLookup("[Name]","MSysObjects","[Name]= 'TableName' And [Type] = 1")

Where TableName is the name of the table you are looking for. If it
exists the function will return the table name, otherwise it wil return
Null.

HTH,
Nikos
 
V

Van T. Dinh

IIRC, [Type] = 1 will only pick up local Tables.

If the Table is an Access-linked Table, [Type] = 6.

If the Table is an ODBC-linked Table, I believe [Type] = 4.

--
HTH
Van T. Dinh
MVP (Access)




Nikos Yannacopoulos said:
Jason,

Use function:

DLookup("[Name]","MSysObjects","[Name]= 'TableName' And [Type] = 1")

Where TableName is the name of the table you are looking for. If it
exists the function will return the table name, otherwise it wil return
Null.

HTH,
Nikos
Dear all,

Could anyone tell me how to check the table exists or not in access.

Thanks,
Jason.
 
Top