Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In Access 2003 or 2007, how can I create a command button to open Google Maps in a separate browser window to a client address on a form? Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Try this:

    Code:
    Private Sub cmdMap_Click()
      Dim strAddress As String
      strAddress = Replace(Me.txtAddress, " ", "+")
      Application.FollowHyperlink "http://maps.google.com?q=" & strAddress
    End Sub
    Here, txtAddress is assumed to be a text box that contains the address you want to look for, e.g.

    Trafalgar Square, London, UK

    or

    60 Richardson Road, Kensington, CA

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    For more info, see Google Map Parameters.

  4. #4
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Cincinnati, Ohio
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not sure if this posted already. (if so sorry) I am trying to pass start (saddr) and destination (daddr) from txtAddress and txtDestination using the following:

    Private Sub cmdMap_Click()
    Dim strAddress As String
    Dim strDestination As String
    strAddress = Replace(Me.txtAddress, " ", "+")
    strDestination = Replace(Me.txtDestination, " ", "+")
    Application.FollowHyperlink "http://maps.google.com/maps?saddr=”&strAddress”&daddr=”&strDestination”"
    End Sub

    Which doesn't work...the addresses don't pass.

    If I manually enter the start and destination it works i.e. 'Application.FollowHyperlink "http://maps.google.com/maps?saddr=”Knoxville, TN”&daddr=”Chicago, IL”"

    Has anyone had success with this?
    Thank you.
    -scott

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You can't use curly quotes in the code. Try this:

    Application.FollowHyperlink "http://maps.google.com/maps?saddr=" & strAddress & "&daddr=" & strDestination

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •