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!

a form calls a macro in another database

Status
Not open for further replies.

jbanas

Programmer
Sep 18, 2007
18
US
thought i could get my code to work but it is saying it is having issues calling access from my button. The command you used to start Microsoft office access contains an option that microsfot office access does not recognize. Below is the code i used to call MS Access and then the macro in the database. Does anyone know where i went wrong in my code. Any help would be great. Thanks


Private Sub Update1_Click()
On Error GoTo Err_Update1_Click
Dim db As Database
Dim htask As Variant
Dim Filename As String
Dim Directory As String
Dim Response As Integer
Dim AppPath As String
Dim ExecutionMacro As String

Set db = CurrentDb


Filename = "\Py_Aives.mdb"
ExecutionMacro = " /Update - Step1"
'the directory where the application lives
Directory = getpath(db.Name)
'finds where Access itself lives
AppPath = SysCmd(acSysCmdAccessDir) & "MSACCESS.EXE"
'MsgBox AppPath & " " & Directory & Filename
htask = Shell(AppPath & " " & Directory & Filename & ExecutionMacro, 1)

Exit_Update1_Click:
Exit Sub

 
Have a look at the /X command line option of msaccess.exe

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top