Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

External Database - Check if object exists 1

Status
Not open for further replies.

mmogul

IS-IT--Management
Dec 1, 2003
218
US
While running one mdb, I want to verify the existence of a form in another mdb. If the form does not exist, then I will transfer the form from the first mdb.

I am unclear on how to verify if the form (or other objects) exist in an external mdb.

Thanks.
 
you can query the external database with dao or ado, and then query the msysobjects hidden table for your form...

--------------------
Procrastinate Now!
 
dim rst as recordset
set rst = currentdb.openrecordset("SELECT MSysObjects.Name
FROM MSysObjects IN 'c:\xxx.mdb'
WHERE (((MSysObjects.Name)="& xxx & ") AND ((MSysObjects.Type)=-32768));")
if rst.bof and rst.eof then

copyform.......
end if
 
Thanks to pwise and crowley16.

In this code:

FROM MSysObjects IN 'c:\xxx.mdb'
WHERE (((MSysObjects.Name)="& xxx & ") AND ((MSysObjects.Type)=-32768));")
if rst.bof and rst.eof then

does the xxx (the second one) represent the form name? If so, does it need to be in single quotes? Without quotes, I get a compile error: variable not defined.


Thanks.
 
do a select * to check just what is in msysobjects...

--------------------
Procrastinate Now!
 
mmogul:
you are right that you need single quotes
 
Thanks all. You were very helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top