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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening custom hyperlinks

Status
Not open for further replies.

MarkWaddington

Programmer
Aug 19, 2002
64
GB
Hi,

I have a command button on my form which when pressed opens Internet Explorer:

Dim stAppName As String

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

This works fine, but goes to my homepage. I would like it to go to a specific web page based on the value that is in the postcode field.

e.g.

field value>

Any simple way of doing this?

Thanks in advance.

Mark Waddington.
 
Open Visualbasic help from a code module and search for "hyperlink"

There are several ways of doing exactly what you want Remember amateurs built the ark - professionals built the Titanic

[yoda]
 
Hey thanks, got it sorted now.. almost.

There is one slight error and it's driving me mad!

If I create a new record and click "locate client" it correctly says "No postcode is entered"

However, if I create a new record, enter a postcode and then DELETE that postcode again, the message box pops up but it STILL opens internet explorer and goes to the web-page. I can't figure it out! Any clues?

The code on my "locate client" command button is as follows:

Dim NewVal As String
Dim MyChar As String

If Not IsNull(Postcode.Value) Then

MyChar = " "
NewVal = Postcode.Value

Do
If InStr(NewVal, MyChar) = 0 Then
Exit Do
Else
NewVal = Left(NewVal, InStr(NewVal, MyChar) - Len(MyChar)) _
& NewChar & Mid(NewVal, InStr(NewVal, MyChar) + Len(MyChar))
End If
Loop

Locate.HyperlinkAddress = (" + NewVal)
Locate.Hyperlink.Follow

Else
MsgBox "No Postcode Entered"
NewVal = ""
DoCmd.CancelEvent

End If



"Instr" is used to simply eliminate any spaces, and that works ok.

Can anyone figure out why it still opens the web-page if I enter a postcode then erase it again?

Thanks.
 
It's ok i figured it out, I just set the HyperlinkAddress to null in the "else" section of the code.

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top