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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need code to run when the databse is opened

Status
Not open for further replies.

Patentinv

Technical User
Aug 26, 2005
84
US
Hi,
I have some code that is suppose to run when the database is
opened, I'm hoping it will copy a form from the database that is opened into an existing database on a clients machine, It will over write there form with this new form both forms have the same name.

I don't know where to place the code so that when the database opens it will run it.

Here's the code,

Delete the old form.
Dim cat As New ADOX.Catalog

' Open the Catalog.
cat.ActiveConnection = _
"Provider='Microsoft.Jet.OLEDB.4.0';" & _
"Data Source='C:\Documents and Settings\data\Desktop\est.mdb';"

' Delete the Form.
cat.Forms.Delete "Contractprop"

'Clean up
Set cat.ActiveConnection = Nothing
Set cat = Nothing

'Copy the new form.
DoCmd.CopyObject("C:\Documents and Settings\data\Desktop\est.mdb", "Contractprop", acForm, "Contractprop")

Does any one know where this would get placed?

And does it appear to copy a form from one database into another database?


Thanks--Any help will be greatly appreciated
 
Hallo,

You should look at the Startup menu option (on Tools or File, I think) and create a form to be opened on startup to include your code. Or you could use the AutoExec macro and RunCode action.

Whether it works or not is something you will find out when you undertake your rigourous testing...

- Frink
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top