Refreshing a command

A

Anne

Thanks to a previous post I have added a command button to my form which
opens a map in mapquest with reference to the postal code on my current
record. It works fine on the first search but each subsequent search on a
different record opens the original map. If I close the form, open it and
try again the first search is correct, but each subsequent search on a new
record opens the original map.

Here is my code.

Private Sub cmdHyperlink_DblClick(Cancel As Integer)
Dim strPath As String
If Not IsNull(Me.PostalCode) Then
strPath = "http://www.mapquest.com/maps/" & Me.PostalCode & "/"
Me.cmdHyperlink.HyperlinkAddress = strPath
End If
End Sub
 
R

Rob Parker

Hi Anne,

The code you posted works fine for me; in a simple test form (continuous
form), with the command button in the form header, clicking the button opens
the map for the current record selected in the form.

You mention "search" in your post; perhaps the problem is with your search
process - are you sure that it's actually changing to a different record?
Try putting a Debug.Print statement to print Me.PostalCode in your code, and
check in the immediate window to make sure that it changes when you "search"
without closing the form.

HTH,

Rob
 
A

Anne

Thanks Rob,

I'm not an advance user but with your post I managed to get my link working
properly. I had used a "command button" and changed the coding. I deleted
it and figured out to insert the hyperlink and then changed the code to make
it open with reference to the postal code. Took a few tries but I got there
in the end. Thanks for you help.
 

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

Similar Threads

hyperlinks 1
MapQuest Buitton on Form 5
Syntax error (missing operator) in expression 2
Passing URL to Google 4
Import File Information 0
Compact and backup back end 10
query look up(?) 4
Program a Search field 2

Top