Results 1 to 13 of 13
  1. #1
    jsbafj is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    8

    I want to click on a field on an access form and search google maps for the field content

    I have spent the last two days trying to figure this out. I have a form that has customer data. I want to be able to click on "Service Address 1" and have google maps open a new window that displays the results.



    Ideally I would like to embed a Web Browser Control but if I have to settle for generic search results that is fine.

    First I tried to setup the address as a hyperlink but that errors out. Then I tried to format the hyperlink to use the data in "Service Address 1" as the search variable but I just can't figure this out and it is driving me crazy.

    I don't care if I have to use VB or another tool, please just tell me how to do this.

    Thanks for the help!

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    You mean you want to show a map for that address?
    If so, I suggest you the Google maps API to obtain a map for that address, postcode or geocordinates using a HTTP request.
    There is a very detailed developers guide to the Google maps APIs on their website.

    As a starting point, look at two example apps on my website
    http://www.mendipdatasystems.co.uk/g...tos/4594736610, http://www.mendipdatasystems.co.uk/g...ion/4594365395

    Good luck
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    jsbafj is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    8
    That seems beyond my skill set and was hoping to avoid API's and such. All I really want to do is click on the field and have it search google for the contents. I dont even need google maps, just a basic search for the contents of the field would work.


    Is there not a simple way to setup the hyperlink to include contents of the field and open browser to search google OnClick either through the hyperlink builder or through VB?

    Basically looking for VB code or a solution that will capture the contents of a field on a form and then open a browser and do a google search the data in the field.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Post 3 was moderated, I'm posting to trigger email notifications.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    What does the field contain? Something like this works:

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

    In this case I'm passing it a string with a UK postcode in it. You can map an address from your data and see what the hyperlink looks like in the browser and then recreate a string with your data in that format.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    jsbafj is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    8
    Thank you, I was pretty far along this path and thought for sure it was going to work. The problem is that I can't get the data from [Service Address 1] to populate in the url search.

  7. #7
    jsbafj is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    8
    Ha it worked!!!!!!! Thank you!!!!

  8. #8
    jsbafj is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    8
    Do you happen to know how I would use the same logic for a Web Browser Control so that it would display the search result within the form?

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Glad you got something working (don't know what "it" referred to). Posting your solution could help somebody else on the same quest.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    jsbafj is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    8
    When I opened the form in design view and went to the properties for the field "Service Address 1" I went into the event builder and just pasted in what you provided which was

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

    I changed strAddress to Service_Address_1 and now when I click the address in the field it opens a browser and shows a map for the address and a street view.

  11. #11
    jsbafj is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    8
    I used the same logic you provided to google search for company name and it opens the browser and enters the company name into the search but does not actually execute the search so I have to hit submit (not a big deal) but wondering if I am missing syntax to make it actually submit?

  12. #12
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Apologies. I thought you needed a map you could download and save.
    That code should work for Company Name or anything else searchable via Google Maps.
    I've just tested it on my own company name and it worked ...though for my old address (must update it with them!)
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  13. #13
    jsbafj is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2019
    Posts
    8
    you are the best, truly grateful

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 09-20-2017, 04:09 AM
  2. Replies: 1
    Last Post: 05-19-2015, 01:59 AM
  3. Google maps from form
    By JeroenMioch in forum Programming
    Replies: 11
    Last Post: 03-04-2014, 10:53 AM
  4. Replies: 4
    Last Post: 05-29-2012, 01:32 PM
  5. using google maps address into a text field
    By thanosgr in forum Programming
    Replies: 5
    Last Post: 04-26-2012, 03:39 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums