runapp macro

  • Thread starter Thread starter Gurkan Ustunkar
  • Start date Start date
G

Gurkan Ustunkar

Hi,
I am trying to run an executable file using runapp comand
in MS Access. I wrote the path as I am supposed to do an I
am 100% sure that the path is correct. The executable file
is expected to run a VC++ program. I am not using MFC(and
I do not know how to use it). I just need to run this exe
file from MS Access. When I run the macro it opens a
window an it immediately closes it. The VC++ program does
not do what it is supposed to do. There is no problem with
exe file because it works when I double-click on it. I
also tried to run it using Shell function in VB. It also
opens a window but again the window is closed without
doing what I want. I need to do this ASAP and I would
really appreciate any kind of help. It would be better if
you could send me an email if you have any answer to my
problem. Thanks again. Regards.

Gurkan
 
Try this in the OnClick event of your button...

Code
-------------------

Private Sub YourButton_Click()
On Error GoTo Err_YourButton_Click

Application.FollowHyperlink "C:\Path\NameOfYourApp.XXX"

Err_YourButton_Click:
If Err = 490 Then
Err.Clear
MsgBox ("File not found. Check path and make sure you have a mapped drive to the folder.")
DoCmd.CancelEvent
Else

End If

Exit Sub
End Sub
 
Back
Top