|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
I have a field that holds an integer representing a ticket number. When a particular button is pushed I would like to call Internet Explorer with the web site address including the appended ticket number from the field.
http://myserver,com/mysite/inquiry.aspx?Inq=[contents of ticket_number_field]
For example, for ticket 2000 the button push would call IE with http://myserver.com/mysite/inquiry.aspx?Inq=2000.
I'm not at all familiar with VBA for & couldn't find a reference in the Access VBA help system about calling external applications. Is there an easier way to do this? I can create a button to call a macro in its event procedure, I just don't know how to code the macro to make the IE call.
|
|
Try
Application.FollowHyperlink http://myserver,com/mysite/inquiry.aspx?Inq= & Me!Ticket_Number_Field]
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please)
"BCW" <bcw[ at ]nospam.com> wrote in message news:esFU7ZOiGHA.3848[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text] >I have a field that holds an integer representing a ticket number. When a >particular button is pushed I would like to call Internet Explorer with the >web site address including the appended ticket number from the field. > > http://myserver,com/mysite/inquiry.aspx?Inq=[contents of > ticket_number_field] > > For example, for ticket 2000 the button push would call IE with > http://myserver.com/mysite/inquiry.aspx?Inq=2000.> > I'm not at all familiar with VBA for & couldn't find a reference in the > Access VBA help system about calling external applications. Is there an > easier way to do this? I can create a button to call a macro in its event > procedure, I just don't know how to code the macro to make the IE call. >
|
|
This is usually done by calling one of the shell functions. I use one of the following examples to open (OuvrirFichier() ) or edit (EditerFichier() ) an HTML file on the local hard drive. OuvrirFichier_AvecPgm() can be used when you the name of the executable that you want to call. There are other possibilities that you will find by making a search on Google for ShellExecute.
I must warn you that I never used one of these to open an URL.
Option Compare Database Option Explicit
Private Const SW_SHOWNORMAL = &H1
Private Declare Function ShellExecute Lib "shell32.dll" _ Alias "ShellExecuteA" ( _ ByVal Hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long
Public Sub OuvrirFichier(NomFichier As String)
Call ShellExecute(0, "open", NomFichier, 0, 0, 0)
End Sub
Public Sub EditerFichier(NomFichier As String)
Call ShellExecute(0, "edit", NomFichier, 0, 0, 0)
End Sub
Public Sub OuvrirFichier_AvecPgm(NomPgm As String, NomFichier As String)
NomFichier = """" & NomFichier & """"
Dim resultat As Long resultat = ShellExecute(0, "open", NomPgm, NomFichier, 0, SW_SHOWNORMAL)
If (resultat <= 32) Then MsgBox "Le programme suivant n'a pas été trouvé : " & NomPgm _ & vbCrLf2 & "Vérifiez son chemin d'accès, svp.", vbCritical, "Erreur!" End If
End Sub
-- Sylvain Lafontaine, ing. MVP - Technologies Virtual-PC E-mail: http://cerbermail.com/?QugbLEWINF
"BCW" <bcw[ at ]nospam.com> wrote in message news:esFU7ZOiGHA.3848[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text] >I have a field that holds an integer representing a ticket number. When a >particular button is pushed I would like to call Internet Explorer with the >web site address including the appended ticket number from the field. > > http://myserver,com/mysite/inquiry.aspx?Inq=[contents of > ticket_number_field] > > For example, for ticket 2000 the button push would call IE with > http://myserver.com/mysite/inquiry.aspx?Inq=2000.> > I'm not at all familiar with VBA for & couldn't find a reference in the > Access VBA help system about calling external applications. Is there an > easier way to do this? I can create a button to call a macro in its event > procedure, I just don't know how to code the macro to make the IE call. >
|
|
Works like a champ, thanks!
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> wrote in message news:eFoKClOiGHA.1204[ at ]TK2MSFTNGP02.phx.gbl...
[Quoted Text] > Try > > Application.FollowHyperlink http://myserver,com/mysite/inquiry.aspx?Inq= & > Me!Ticket_Number_Field] > > > -- > Doug Steele, Microsoft Access MVP > http://I.Am/DougSteele> (no private e-mails, please) > > > "BCW" <bcw[ at ]nospam.com> wrote in message > news:esFU7ZOiGHA.3848[ at ]TK2MSFTNGP04.phx.gbl... >>I have a field that holds an integer representing a ticket number. When a >>particular button is pushed I would like to call Internet Explorer with >>the web site address including the appended ticket number from the field. >> >> http://myserver,com/mysite/inquiry.aspx?Inq=[contents of >> ticket_number_field] >> >> For example, for ticket 2000 the button push would call IE with >> http://myserver.com/mysite/inquiry.aspx?Inq=2000.>> >> I'm not at all familiar with VBA for & couldn't find a reference in the >> Access VBA help system about calling external applications. Is there an >> easier way to do this? I can create a button to call a macro in its >> event procedure, I just don't know how to code the macro to make the IE >> call. >> > >
|
|
|