Opening a Map based of data in a form.

W

Wes Conner

I would like to be able to open google maps and generate a map based
on fields in a MS Access Database. I will have 4 fields; "Address"
"City" "Zip" "State" . Is it possible to take this information,
produce a hyperlink, and have a browser open said hyper link? If so
could some one please explain how, if not, maybe someone has a
seperate or better solution?
 
K

Keven Denen

I would like to be able to open google maps and generate a map based
on fields in a MS Access Database.  I will have 4 fields;  "Address"
"City"  "Zip"  "State" .  Is it possible to take this information,
produce a hyperlink, and have a browser open said hyper link?  If so
could some one please explain how, if not, maybe someone has a
seperate or better solution?

Something along these lines should work.

Dim strAddress As String
strAddress = address & "%20" & city & "%20" & state & "%20" & zip
Application.FollowHyperlink "http://maps.google.com/maps?q=" &
strAddress

Keven Denen
 
H

Hans Up

Wes said:
I get an error when I run this. Specifically a syntax error regarding
this line

Application.FollowHyperlink "http://maps.google.com/maps?q=" &

Any suggestions? I am MS Access 2007 if that would change anything,
thanks in advance.

Your newsreader probably showed this as two lines:

Application.FollowHyperlink "http://maps.google.com/maps?q=" &
strAddress

Use the line continuation character (underscore) to let VBA know those 2
physical lines are a single logical line.

Application.FollowHyperlink "http://maps.google.com/maps?q=" & _
strAddress

Or just rewrite the thing like this:

Const cstrBase As String = "http://maps.google.com/maps?q="
Dim strAddress As String
strAddress = address & "%20" & city & "%20" & state & "%20" & zip
Application.FollowHyperlink cstrBase & strAddress
 
W

Wes Conner

Your newsreader probably showed this as two lines:

Application.FollowHyperlink "http://maps.google.com/maps?q=" &
strAddress

Use the line continuation character (underscore) to let VBA know those 2
physical lines are a single logical line.

Application.FollowHyperlink "http://maps.google.com/maps?q=" & _
strAddress

Or just rewrite the thing like this:

Const cstrBase As String = "http://maps.google.com/maps?q="
Dim strAddress As String
strAddress = address & "%20" & city & "%20" & state & "%20" & zip
Application.FollowHyperlink cstrBase & strAddress

Wonderful!! thank you for the help.
 
C

Chai

This is very interesting, how do you do this?

Is there a button on your form that picks up these four fields?

Thank you
 

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