Creating a button to go to mapquest and auto fill in the address i

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I'm trying to create a button in access 2007 that will
a) open maps.google.com (this part i can get no problem)
b) automatically enter the address information from the record.

I think it should be something like:
Private Sub Strip_Map_Click()
On Error GoTo Err_Strip_Map_Click

Dim stAddress As String
Dim stCity As String
Dim stState As String
Dim stZip As String
Dim stFullAddress As String

stAddress = [ADDRESS]
stCity = [CITY]
stState = [STATE]
stZip = [ZIP]

Access.FollowHyperlink "http://www.mapquest.com/maps/map.adp?" &
"formtype=address&searchtype=address" & URLEncode("&address=" &
Trim(Nz([stAddress], "") & "&city=" & Trim(Nz([stCity], "")) & "&state=" &
Trim(Nz([stState], "")) & "&zip=" & Trim(Nz([stZip], ""))))

Debug.Print "http://www.mapquest.com/maps/map.adp?" &
"formtype=address&searchtype=address" & URLEncode("&address=" &
Trim(Nz([stAddress], "") & "&city=" & Trim(Nz([stCity], "")) & "&state=" &
Trim(Nz([stState], "")) & "&zip=" & Trim(Nz([stZip], ""))))

Exit_Strip_Map_Click:
Exit Sub

Err_Strip_Map_Click:
MsgBox Err.Description
Resume Exit_Strip_Map_Click

End Sub

But obviously it isn't working properly. Anyone have any ideas?

Thank you!
 
What error are you encountering?

Have you created a function named URLEncode (as I don't believe there's such
a function in Access)?
 
Actually the error I'm getting is about the URLEncode.

Compile Error:
Sub or Function not defined.

With URLEncode highlighted.

I originally got this code from a different post on these forums that was
made back in 2005, so I may be going in the completely wrong direction now.

Douglas J. Steele said:
What error are you encountering?

Have you created a function named URLEncode (as I don't believe there's such
a function in Access)?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Eere said:
Hello,

I'm trying to create a button in access 2007 that will
a) open maps.google.com (this part i can get no problem)
b) automatically enter the address information from the record.

I think it should be something like:
Private Sub Strip_Map_Click()
On Error GoTo Err_Strip_Map_Click

Dim stAddress As String
Dim stCity As String
Dim stState As String
Dim stZip As String
Dim stFullAddress As String

stAddress = [ADDRESS]
stCity = [CITY]
stState = [STATE]
stZip = [ZIP]

Access.FollowHyperlink "http://www.mapquest.com/maps/map.adp?" &
"formtype=address&searchtype=address" & URLEncode("&address=" &
Trim(Nz([stAddress], "") & "&city=" & Trim(Nz([stCity], "")) & "&state=" &
Trim(Nz([stState], "")) & "&zip=" & Trim(Nz([stZip], ""))))

Debug.Print "http://www.mapquest.com/maps/map.adp?" &
"formtype=address&searchtype=address" & URLEncode("&address=" &
Trim(Nz([stAddress], "") & "&city=" & Trim(Nz([stCity], "")) & "&state=" &
Trim(Nz([stState], "")) & "&zip=" & Trim(Nz([stZip], ""))))

Exit_Strip_Map_Click:
Exit Sub

Err_Strip_Map_Click:
MsgBox Err.Description
Resume Exit_Strip_Map_Click

End Sub

But obviously it isn't working properly. Anyone have any ideas?

Thank you!
 
You're going to need to find out what URLEncode does, and code that function
into your application.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Eere said:
Actually the error I'm getting is about the URLEncode.

Compile Error:
Sub or Function not defined.

With URLEncode highlighted.

I originally got this code from a different post on these forums that was
made back in 2005, so I may be going in the completely wrong direction
now.

Douglas J. Steele said:
What error are you encountering?

Have you created a function named URLEncode (as I don't believe there's
such
a function in Access)?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Eere said:
Hello,

I'm trying to create a button in access 2007 that will
a) open maps.google.com (this part i can get no problem)
b) automatically enter the address information from the record.

I think it should be something like:
Private Sub Strip_Map_Click()
On Error GoTo Err_Strip_Map_Click

Dim stAddress As String
Dim stCity As String
Dim stState As String
Dim stZip As String
Dim stFullAddress As String

stAddress = [ADDRESS]
stCity = [CITY]
stState = [STATE]
stZip = [ZIP]

Access.FollowHyperlink "http://www.mapquest.com/maps/map.adp?" &
"formtype=address&searchtype=address" & URLEncode("&address=" &
Trim(Nz([stAddress], "") & "&city=" & Trim(Nz([stCity], "")) &
"&state=" &
Trim(Nz([stState], "")) & "&zip=" & Trim(Nz([stZip], ""))))

Debug.Print "http://www.mapquest.com/maps/map.adp?" &
"formtype=address&searchtype=address" & URLEncode("&address=" &
Trim(Nz([stAddress], "") & "&city=" & Trim(Nz([stCity], "")) &
"&state=" &
Trim(Nz([stState], "")) & "&zip=" & Trim(Nz([stZip], ""))))

Exit_Strip_Map_Click:
Exit Sub

Err_Strip_Map_Click:
MsgBox Err.Description
Resume Exit_Strip_Map_Click

End Sub

But obviously it isn't working properly. Anyone have any ideas?

Thank you!
 
Go to Google and look at their developer pages. They provide complete help
and even how to call from VBA. Basically you just build a hyperlink from
your fields & concatenation the text and pass it off to the browser.
Douglas J. Steele said:
You're going to need to find out what URLEncode does, and code that
function into your application.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Eere said:
Actually the error I'm getting is about the URLEncode.

Compile Error:
Sub or Function not defined.

With URLEncode highlighted.

I originally got this code from a different post on these forums that was
made back in 2005, so I may be going in the completely wrong direction
now.

Douglas J. Steele said:
What error are you encountering?

Have you created a function named URLEncode (as I don't believe there's
such
a function in Access)?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Hello,

I'm trying to create a button in access 2007 that will
a) open maps.google.com (this part i can get no problem)
b) automatically enter the address information from the record.

I think it should be something like:
Private Sub Strip_Map_Click()
On Error GoTo Err_Strip_Map_Click

Dim stAddress As String
Dim stCity As String
Dim stState As String
Dim stZip As String
Dim stFullAddress As String

stAddress = [ADDRESS]
stCity = [CITY]
stState = [STATE]
stZip = [ZIP]

Access.FollowHyperlink "http://www.mapquest.com/maps/map.adp?" &
"formtype=address&searchtype=address" & URLEncode("&address=" &
Trim(Nz([stAddress], "") & "&city=" & Trim(Nz([stCity], "")) &
"&state=" &
Trim(Nz([stState], "")) & "&zip=" & Trim(Nz([stZip], ""))))

Debug.Print "http://www.mapquest.com/maps/map.adp?" &
"formtype=address&searchtype=address" & URLEncode("&address=" &
Trim(Nz([stAddress], "") & "&city=" & Trim(Nz([stCity], "")) &
"&state=" &
Trim(Nz([stState], "")) & "&zip=" & Trim(Nz([stZip], ""))))

Exit_Strip_Map_Click:
Exit Sub

Err_Strip_Map_Click:
MsgBox Err.Description
Resume Exit_Strip_Map_Click

End Sub

But obviously it isn't working properly. Anyone have any ideas?

Thank you!
 
After 30 minutes of searching, I can't seem to find the VBA coding area for
Goggle Maps. I found something about opening Google Earth from excel, but
that isn't really what I'm trying to do here.
 
Back
Top