In continuation from above...
Put a TextBox on a From and run this code:
Private Sub GMaps_Click_Click()
Dim MyHyperlink As String
Dim strGoogleLoaction As String
strGoogleLoaction = Replace([txtCodesPostale], " ", "+")
MyHyperlink = "
http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q="
& strGoogleLoaction &
"&sll=40.784181,-73.949189&sspn=0.014882,0.030942&ie=UTF8&t=h&z=12"
Application.FollowHyperlink MyHyperlink
End Sub
The Zip code goes in the TextBox.
Now, for something a little more interesting...
Put two TextBoxes on another Form and run this code:
'**********Begin Code************************
Option Compare Database
Option Explicit
Sub GoogleMap_Click()
'
http://www.utteraccess.com/forums/showflat.php?Cat=&Number=1356166
' Given a FROM address and TO address, will start Internet Explorer,
' and call up GoggleMaps to give directions with total mileage estimate!
' Example of calling from Immediate window to get directions from
' the Space Needle in Seattle to the White House in Wash. DC, USA:
' Call GoogleMap("1600 Pennsylvania Avenue, Washington, DC", _
"400 Broad St, Seattle, WA 98109")
Dim strURL As String
Dim ie As Object
'Convert spaces to + sign
strStartingPoint = Replace(strStartingPoint, " ", "+")
strDestination = Replace(strDestination, " ", "+")
strURL = "
http://maps.google.com/maps?f=d&hl=en&saddr=" & strStartingPoint &
"&daddr=" & strDestination & "&ie=UTF8&z=5&om=1"
Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate strURL
ie.Visible = True
End Sub
Public Function Mapper_Click(strCity As Variant, strState As Variant,
strAddress As Variant, strZip As Variant) As Variant
' Example of calling from Immediate Window for the Space Needle
' located in Seattle, WA., USA:
' Call Mapper_Click ("Seattle", "WA", "400 Broad St", "98109")
On Error GoTo Err_Mapper_Click
Dim strFullAddress As Variant
Dim strMapquest As Variant
strFullAddress = strAddress & "&city=" & strCity _
& "&state=" & strState _
& "&zipcode=" & strZip
strMapquest = "
http://www.mapquest.com/maps/map.adp?searchtype=" &
"address&formtype=search&countryid=US" & "&addtohistory=&country=US&address="
& strFullAddress & "&historyid=&submit=Get Map"
'Remove trailing spaces
strMapquest = Trim(strMapquest)
'Change imbedded spaces with plus signs
strMapquest = Replace(strMapquest, " ", "+", 1, , vbTextCompare)
Application.FollowHyperlink strMapquest, , True
strMapquest = vbNullString
Exit_Mapper_Click:
Exit Function
Err_Mapper_Click:
MsgBox Err.Number & "-" & Err.Description
Resume Exit_Mapper_Click
End Function
I'm assuming you know a little bit about Access to get this running, just
basic stuff like naming your TextBoxes...
HTH,
Ryan---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
Pendragon said:
This will get you to internet explorer and the appropriate web address.
Call Shell("Explorer.exe http://" & YourWebAddress)
I have an application that automatically gets MapQuest directions based on
Access data and populates MapQuest's Get Directions website. Essentially I
went to MapQuest and put in a test address, then copied the URL and filled in
the necessary blanks with my Access variables (holding address information).
For your situation, you would need to know how to identify each of the
fields to populate, then add that into your Call statement. For example, the
following is the initial part of the MapQuest statement.
http://www.mapquest.com/directions/main.adp?go=1&do=nw&ct=NA&1y=US&1a=[My
From Address Goes Here]&1p=[Second Address Line]&1c=[From City] etc etc etc.
Hope that might get you started somewhere.
Is there an Access utility to do this? said:
I would like a button on a form, that would take a the name of a company (on
the form), go to a particular web page that has input fields (for search),
populate the input fields, and execute the search. The web page would come
back, just as a web page comes back if I have one listed as part of company
data and click on it, except that the page that would come back would be
relevant to the company (based on the input of the company name). So this is
to automate clicking on a web address, populating fields and hitting enter.
Can this be done? Is it requires VBA programming expertise, is there a
resource around where I could have it done for hire?