Evenet Procedure Run App Code Help

J

Jody

I have created a Run Application button that loads IE. I am a VERY NEWBIE to
programming and would like to know how I can program the button to load a URL
listed in one of the form fields. The URL will be diffrent for each record.
The particular field name is 'adminURL'.

I would be appreciative if someone could insert what I need so I can see how
the syntax should be. I would assume there would be some variable that
contains the field name inserted after the IE executable? Does the field
data type need to be a 'hyperlink' or will 'text' be sufficient? I prefer to
use 'text' if at all possible as it is much easier to edit than 'hyperlink'
datatypes.

Option Compare Database
------------------------------------------------------------------
Private Sub IE_Command28_Click()
On Error GoTo Err_IE_Command28_Click

Dim stAppName As String

stAppName = "C:\Program Files\Internet Explorer\IEXPLORE.EXE"
Call Shell(stAppName, 1)

Exit_IE_Command28_Click:
Exit Sub

Err_IE_Command28_Click:
MsgBox Err.Description
Resume Exit_IE_Command28_Click

End Sub
 
D

Douglas J. Steele

You could try:

stAppName = Chr$(34) & "C:\Program Files\Internet Explorer\IEXPLORE.EXE" & _
Chr(34) & " " & Chr$(34) & adminURL

or you could simply use

Application.FollowHyperlink adminURL

instead of using Shell if you're willing to have the URL open in whatever
browser's set to the default.
 
J

Jody

Thanks you for your help. I tried a couple of things below and either I just
do not understand exactly where to put the code and what gets replaced with
what or there is some other problem.

With the following I get either a type mismatch error or Offices closes and
asks me to send a report to microsoft.

1. I Replaced
=========
stAppName = "C:\Program Files\Internet Explorer\IEXPLORE.EXE"
Call Shell(stAppName, 1)

With
====
stAppName = Chr$(34) & "C:\Program Files\Internet Explorer\IEXPLORE.EXE" & _
Chr(34) & " " & Chr$(34) & adminURL


2. After restoring the original code I Just replaced
===============================
Call Shell(stAppName, 1)

With
===
Application.FollowHyperlink adminURL

Any suggestions?
Thanks - Jody
 
D

Douglas J. Steele

Sorry, my mistake. I forget the & Chr$(34) at the end of the string.

stAppName = Chr$(34) & "C:\Program Files\Internet Explorer\IEXPLORE.EXE" & _
Chr(34) & " " & Chr$(34) & adminURL & Chr$(34)
 
J

Jody

Thanks Douglas! That worked great! However when I replaced the Call Shell
part with the Application.FollowLink... I got an error:
"Cannot locate the Internet server or porxy server."
So I did not use that and it's fine!

Thanks again - Jody
 
J

Jody

Hi Douglas - Is there a way to do the same thing but with Opening Outlook and
inserting the email address from the one ot tow Access fields ('emailAddress'
and/or 'emailAlt' ) into the TO: field of a new email message?

Thant Event Procedure Code is so far:
==============================
MsgBox Err.Description
Resume Exit_OL_Command361_Click

End Sub
Private Sub OL_Command362_Click()
On Error GoTo Err_OL_Command362_Click

Dim stAppName As String

stAppName = "C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE"
Call Shell(stAppName, 1)

Exit_OL_Command362_Click:
Exit Sub

Err_OL_Command362_Click:
MsgBox Err.Description
Resume Exit_OL_Command362_Click

End Sub
==============================
Thanks - Jody
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top