• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 780
  • Last Modified:

Google maps Search from MS Access passing the address

I want to search the distance by google map using the ms access form(not open the IE), but it is not working, it just open the google map home page but not auto fill the postcode and seaching???
Private Sub cmdSearch_Click()
On Error Resume Next
    Me.WebBrowser1.Navigate "http://maps.google.co.uk/maps?hl=en&tab=wl"
Do While Me.WebBrowser1.Busy
      DoEvents
Loop
WebBrowser1.Visible = True
WebBrowser1.all.Item("d_launch").Click
WebBrowser1.Forms("d_edit_form").Item("saddr").Value = "ne3 5hn"
WebBrowser1.Forms("d_edit_form").Item("daddr").Value = "ne3 4pl"
'WebBrowser1.Document.all("daddr").Value = "ne3 4pl"
WebBrowser1.Document.Forms("d_edit_form").Item("btnG").Click
 
End Sub

Open in new window

0
Uncochen
Asked:
Uncochen
  • 4
1 Solution
 
rockiroadsCommented:
build up the url as suggested here http://www.vb-helper.com/howto_google_map.html then load that in your access form browser
0
 
rockiroadsCommented:
eg assume postcode is in a variable called txtPostCode
using the url below, does it work?

WebBrowser1.Navigate = "http://maps.google.com/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q=" & txtPostCode & "&ie=UTF8&t=m"
0
 
rockiroadsCommented:
Newcastle Upon Tyne eh. Stafford isnt too far is it, there used to be a great Kebab shop there, oooh that tender meat :)
0
 
rockiroadsCommented:
did it work?

and silly me, I was thinking of Lyme, not Tyne. Stafford is like a million miles away from toonside, lol.

Need to make a slight adjustment to the string. Its to do with the space in between the postcode. Can either add %20 or remove it altogether, google maps should still accept that

eg

WebBrowser1.Navigate = "http://maps.google.com/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q=" & replace(txtPostCode," ","") & "&ie=UTF8&t=m"

0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now