View Single Post
  #12  
Old February 7th, 2010, 12:24 AM posted to microsoft.public.access.forms
MartyO
external usenet poster
 
Posts: 40
Default open Map Quest from Form

Awesome! This is exactly what I needed to do for my Leads database. I used
your code...it was so easy! And I changed it up a little bit to actuallyy
look for my customer's address, not just the zipcode. Here it is. Thanks so
much!
Private Sub cmdHyperlink_Click()
Dim strPath As String
Dim strMapIt As String
If Not IsNull(Me.Address) Then
strPath = "http://www.mapquest.com/maps?city=" & Me.City & "&state=" &
Me.State & "&address=" & Me.Address & "&zip=" & Me.Zip &
"&country=US&CID=lfmaplink/"
Me.cmdHyperlink.HyperlinkAddress = strPath
End If

End Sub

"BillD" wrote:

This post is so old I decided to use a new post under "MapQuest Button On Form"

"BillD" wrote:

Arvin:
Mapquest must have changed their code. My Mapquest button on the form does
not work anymore. The reason is that in Canadian Postal Codes there is a
space (ie. E3A 3N7). My data is stored this way. Mapquest used to accept this
format but not anymore. How do I delete the space in the hyperlink created
from the event on click (button on Form).
Your help would be greatly appreciated. Here is my code.
Private Sub cmdHyperlink_Click()
Dim strPath As String
If Not IsNull(Me.Postal_Code) Then
strPath = "http://www.mapquest.com/maps/" & Me.Postal_Code & "/"
Me.cmdHyperlink.HyperlinkAddress = strPath
End If
End Sub
"Arvin Meyer [MVP]" wrote:

The URL is simple:

http://www.mapquest.com/maps/32708/

is mine so do it as a string in code, use a command button named
cmdHyperlink with code like the following (txtZipCode being the name of the
textbox containing the ZipCode field.):

Private Sub cmdHyperlink_Click()
Dim strPath As String
If Not IsNull(Me.txtZipCode) Then
strPath = "http://www.mapquest.com/maps/" & Me.txtZipCode & "/"
Me.cmdHyperlink.HyperlinkAddress = strPath
End If
End Sub

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"BillD" wrote in message
...
You're right, I don't think I would be able to do it.
Thanks again for your advice
Bill D.

"Klatuu" wrote:

You still have to contstruct the URL so it will pull up the map you want.
If
you can do that, you may try the FollowHyperlink method, but if you don't
know VBA, I don't think you will be able to do it.
--
Dave Hargis, Microsoft Access MVP


"BillD" wrote:

I thank you for the detailed response.
Unfortunately, I am not a programmer. I don't think I could change the
code
you sent to accomplish the task. Is there an easier way to accomplish
opening
a Map Quest area map from a field on a form called "Postal Code".

Thanks again,
Bill D.

"Klatuu" wrote:

First, you need to download the code at this site:

http://www.mvps.org/access/api/api0018.htm

The normal FollowHyperlink will thow up a security screen that is
annoying,
but this does not.

Then you need to experiment to determine how the URL should be
styled to
return the map you need. This will probably take a bit of tinkering.
Then
you can use the following as an example. In this code, I open Test
Director
with a user name and logon id and direct it to a specific task:

Private Sub cmdTestDirector_Click()
Const conHyperLink As String =
"testdirector:bootlyboos.corp.wingy.com:8080/" & _

"qcbin,DEFAULT,BingBanDevelopment,NameHere,Passwor dHere;2:TaskNumberHere"
Dim strPwd As String
Dim strUser As String
Dim strhyperlink As String

strUser = GetUserID
strPwd = Nz(DLookup("[TestDirectorPassword]", "dbo_employee",
"[EmployeeLogin] = """ & _
strUser & """"), vbNullString)
If strPwd = vbNullString Then
MsgBox strUser & " Not Found in the Employee Table" &
vbNewLine & _
"Please contact an administrator", vbExclamation, "Stars"
Else
strhyperlink = Replace(conHyperLink, "NameHere", strUser)
strPwd = EncryptCode(1, strPwd)
strPwd = Replace(strPwd, "None", vbNullString)
strhyperlink = Replace(strhyperlink, "PasswordHere", strPwd)
strhyperlink = Replace(strhyperlink, "TaskNumberHere",
Me.txtTaskNumber)
Call fHandleFile(strhyperlink, WIN_NORMAL)
End If
End Sub

--
Dave Hargis, Microsoft Access MVP


"BillD" wrote:

I would like to open Map Quest from my records Form and have the
Postal Code
automatically inserted in Map Quest so I can then click on street
view and
have the map show the location with surrounding streets. Then I
could print
off the Map.
I would be using this to show where people in my database live. I
would only
need addresses for New Brunswick Canada.

Any help greatly appreciated.

Bill D.