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

Code Debugging???

Status
Not open for further replies.

jane30

Programmer
Nov 14, 2000
92
US
Hi, I have two dbs: db1 and db2. Db1 has an autoexec which imports the data. Then transfer the data to DB2, which doesn't have autoexec, and quit. After several necessary steps of massaging the data, its timer event runs macro1 in DB1. Here is my code:

Private Sub Form_Timer()
On Error GoTo Form_Timer_Err

DoCmd.SetWarnings False
Call Shell("c:\program files\microsoft office\office\msaccess.exe ""C:\db2.mdb"" /x Macro A", 1)
DoCmd.Close
DoCmd.SetWarnings True
DoCmd.Quit


Form_Timer_Exit:
Exit Sub

Form_Timer_Err:
MsgBox Error$
Resume Form_Timer_Exit
End Sub


The problem is when DB1 opens, it starts autoexec, not macro A specified in my code. How can I work around this situation?

Your time and help are highly appreciated.
 
Yikes, I think you are stuck. I've had all kinds of trouble with autoexecs too so I simply don't use them. However I believe you can do whatever you want in code between the databases. Look under the openDatabase method in the help file or post what you are trying to do (ie. move data from one table in one db to another table in another db) and I'm sure we can help.

Hope this helps,
Rewdee
 
Jane,

When db1 is run, it will run the autoexec macro. What you could do is convert the autoexec to a module, add a msgbox to it asking if you want to import and code the stuff which would run in the autoexec on a true part of an if statement and the other stuff on the false part.

HTH

Craig
 
Hi, folks! I solved the problem. It's quite simple: before the code in DB2 run the macro in DB1, rename the autoexec to anther name in my automation process in DB1. then rename it back to autoexec at the end of the process before quiting Access.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top