Hyperlink with Record Information

B

Bill

I would like to place a button on the MainForm of my
Access 2002 database the will activate a hyperlink to
MapQuest so a map of the record location will be displayed.

The hyperlink information would read as follows where the
[City], [State], [Address], [ZipCode] and [Country] will
fill in with the information from the record being
displayed on the MainForm.

http://www.mapquest.com/maps/map.adp?city=[City]&state=
[State]&address=[Address]&zip=[ZipCode]&&country=[Country]
&&zoom=5

Can anyone give me some assistance in setting up a Module
that can perform this task?
 
D

Douglas J. Steele

I'd create a string that represents the URL:

Dim strLookup As String
Dim strURL As String

If Len(Me.City) > 0 Then
If Len(strLookup) > 0 Then
strLookup = strLookup & "&"
End If
stLookup = strLookup & "city=" & Replace(Me.City, " ", "+")
End If

If Len(Me.State) > 0 Then
If Len(strLookup) > 0 Then
strLookup = strLookup & "&"
End If
stLookup = strLookup & "state=" & Replace(Me.State, " ", "+")
End If

If Len(Me.Address) > 0 Then
If Len(strLookup) > 0 Then
strLookup = strLookup & "&"
End If
stLookup = strLookup & "address=" & Replace(Me.Address, " ", "+")
End If

and so on until you've looked at each field of interest.

strURL = http://www.mapquest.com/maps/map.adp

If Len(strLookup) > 0 Then
strURL = strURL & "?" & strLookup
End If

I'd then copy the code from http://www.mvps.org/access/api/api0018.htm at
"The Access Web", and call it like:

strReturn = Call fHandleFile(strURL, WIN_NORMAL)
 
B

Bill

Thanks for your help Doug!
-----Original Message-----
I'd create a string that represents the URL:

Dim strLookup As String
Dim strURL As String

If Len(Me.City) > 0 Then
If Len(strLookup) > 0 Then
strLookup = strLookup & "&"
End If
stLookup = strLookup & "city=" & Replace (Me.City, " ", "+")
End If

If Len(Me.State) > 0 Then
If Len(strLookup) > 0 Then
strLookup = strLookup & "&"
End If
stLookup = strLookup & "state=" & Replace (Me.State, " ", "+")
End If

If Len(Me.Address) > 0 Then
If Len(strLookup) > 0 Then
strLookup = strLookup & "&"
End If
stLookup = strLookup & "address=" & Replace (Me.Address, " ", "+")
End If

and so on until you've looked at each field of interest.

strURL = http://www.mapquest.com/maps/map.adp

If Len(strLookup) > 0 Then
strURL = strURL & "?" & strLookup
End If

I'd then copy the code from
http://www.mvps.org/access/api/api0018.htm at
"The Access Web", and call it like:

strReturn = Call fHandleFile(strURL, WIN_NORMAL)


--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


I would like to place a button on the MainForm of my
Access 2002 database the will activate a hyperlink to
MapQuest so a map of the record location will be displayed.

The hyperlink information would read as follows where the
[City], [State], [Address], [ZipCode] and [Country] will
fill in with the information from the record being
displayed on the MainForm.

http://www.mapquest.com/maps/map.adp?city=[City]&state=
[State]&address=[Address]&zip=[ZipCode]&&country= [Country]
&&zoom=5

Can anyone give me some assistance in setting up a Module
that can perform this task?


.
 

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