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!

can a form call a macro in another mdb in access

Status
Not open for further replies.

jbanas

Programmer
Sep 18, 2007
18
US
i thought i could get my code to work but it is saying it is having issues calling access from my button. Does anyone have a snipet of code that allows the user to click on a button and then it will call a macro and/or 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
 





Please post Access VBA questions in Forum705.

Skip,

[glasses] When a group touring the Crest Toothpaste factory got caught in a large cooler, headlines read...
Tooth Company Freeze a Crowd! and
Many are Cold, but Few are Frozen![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top