473,432 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,432 software developers and data experts.

Doing maps and hyperlinks

I'd like to set up an event procedure that when the city field is
double clicked they are sped away to a google map showing directions
and distance from our city (nashville) to the client city. The link is
as follows, but I can't figure out how to implement it:

http://maps.google.com/maps?f=d&hl=e...lle,+TN&daddr=[City],+[State]&sll=36.047349,-86.716609&sspn=0.0072,0.014462&ie=UTF8&z=9&om=1

Thanks for your help!

Aug 23 '07 #1
3 2621
use Application.FollowHyperlink
"magmike" <ma******@yahoo.comwrote in message
news:11**********************@r23g2000prd.googlegr oups.com...
I'd like to set up an event procedure that when the city field is
double clicked they are sped away to a google map showing directions
and distance from our city (nashville) to the client city. The link is
as follows, but I can't figure out how to implement it:

http://maps.google.com/maps?f=d&hl=e...lle,+TN&daddr=[City],+[State]&sll=36.047349,-86.716609&sspn=0.0072,0.014462&ie=UTF8&z=9&om=1

Thanks for your help!

Aug 23 '07 #2
On Aug 23, 3:27 pm, "Karl" <some...@sbcglobal.bizwrote:
use Application.FollowHyperlink

"magmike" <magmi...@yahoo.comwrote in message

news:11**********************@r23g2000prd.googlegr oups.com...
I'd like to set up an event procedure that when the city field is
double clicked they are sped away to a google map showing directions
and distance from our city (nashville) to the client city. The link is
as follows, but I can't figure out how to implement it:
http://maps.google.com/maps?f=d&hl=e...shville,+TN&da...[City],+[State]&sll=36.047349,-86.716609&sspn=0.0072,0.014462&ie=UTF8&z=9&o*m=1
Thanks for your help!- Hide quoted text -

- Show quoted text -
That was easy. Thanks!

Aug 23 '07 #3
magmike wrote:
I'd like to set up an event procedure that when the city field is
double clicked they are sped away to a google map showing directions
and distance from our city (nashville) to the client city. The link is
as follows, but I can't figure out how to implement it:

http://maps.google.com/maps?f=d&hl=e...lle,+TN&daddr=[City],+[State]&sll=36.047349,-86.716609&sspn=0.0072,0.014462&ie=UTF8&z=9&om=1

Thanks for your help!
From a post a year or two ago I read in this group I came up with this
method. I pass to MakeUrl the arguments "Map" or "Driving". If "Map",
it creates just the map of the FROM address, if driving it has the
directions for the FROM to TO addresses.

I have a form with a "FROM" Address, city, state, zip as well as the
same for the TO fields. Press the command button to present the values.

I also added a command button to swap the From/To values on the form
even tho I could have passed an argument in the URL to present reverse
directions.

I do require both city and state in the form. I really don't care about
the zip but you can mod the code to whatever. Beyond that, if you have
a form with from/to fields using the field names in the routine then
this code should run without a hitch.

Private Sub MakeURL(strType As String)
On Error GoTo Err_MakeURL
Dim strURL As String
Dim objBrowser As Object

If IsNull(Me.City) Or IsNull(Me.State) Then
MsgBox "You need to supply at least the city and state.", ,
"Missing Info"
Me.City.SetFocus
ElseIf strType = "Driving" And (IsNull(Me.ToCity) Or
IsNull(Me.ToState)) Then
MsgBox "You need to supply at least eding city and state for
driving directions.", , "Missing Info"
Me.ToCity.SetFocus
Else
'Declare variables.

strURL = CreateUrl(Me.Address, Me.City, Me.State, Me.ZipCode)
If strType = "Driving" Then
strURL = strURL & "+" & "to" & "+" &
CreateUrl(Me.ToAddress, Me.ToCity, Me.ToState, Me.ToZipCode)
End If
strURL = "http://maps.google.com/maps?q=" & strURL &
"&iwloc=A&hl=en"

Dim obj As Object
Set obj = CreateObject("InternetExplorer.Application")
With obj
.Navigate2 strURL
.Visible = True
End With
Set obj = Nothing
End If
Exit_MakeURL:
Exit Sub

Err_MakeURL:
MsgBox Err.Description
Resume Exit_MakeURL

End Sub
Private Function CreateUrl(strAddress As Variant, strCity As String,
strState As String, strZip As Variant) As String
'generate the URL to pass to Google in browser.
Dim strURL As String
Dim strOrig As String
Dim intPos As Integer

If Not IsNull(strAddress) Then
strOrig = strAddress
Do While True
If strOrig <"" Then
intPos = InStr(strOrig, " ")
If intPos 0 Then
strURL = strURL & Left(strOrig, intPos - 1) & "+"
strOrig = LTrim(Mid(strOrig, intPos + 1))
Else
strURL = strURL & strOrig & "+"
Exit Do
End If
Else
Exit Do
End If
Loop
End If
strURL = strURL & strCity & "+" & strState & "+"
If Not IsNull(strZip) Then strURL = strURL & strZip & "+"

CreateUrl = Left(strURL, Len(strURL) - 1)

End Function
Aug 23 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: Steven T. Hatton | last post by:
Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own...
6
by: Colleyville Alan | last post by:
I have an application that has an Access table that stores the locations of slides in a Powerpoint file. This used to work fine when there were about 4 files and 200 slides. The database would...
0
by: Tim | last post by:
Access 97: I have a table with a hyperlink field that I display on a form. I can click on the form field and the hyperlink activates correctly. However, if I try to activate the hyperlink using VB...
3
by: Sean | last post by:
Have you ever wanted to add the great features inherent in Google Maps? Here is how you do it. ============== == STEP ONE == ============== Create a new MS Access form called frmGoogleMap....
4
by: Seefor | last post by:
Hi, I want my text hyperlinks to have a dotted border underneath, so I did this which works fine: a, a:link, a:visited, a:hover, a:active { color: #000; text-decoration: none;
1
by: Robin | last post by:
Hello! I'm having trouble with links and hyperlinks in MS Access 2003 - any help would be great! Question 1! The "insert hyperlink" icon opens a browser window, allows the user to browse...
1
by: Janna | last post by:
Hello tech savvy gurus! I hope someone can help me! THE PROBLEM: "Cannot open specified file" when I click on a hyperlink in an Access database when it is located on our server. THE...
1
by: mforema | last post by:
Hi Everybody, I have an Access table with a field filled with outdated hyperlinks. I also have an excel spreadsheet that is the master list for these hyperlinks. The spreadsheet will be updated...
12
by: Frustratee | last post by:
Sorry guys, this is killing me. I have been fighting this issue for several weeks, to no avail. I am exporting the results of a query to an excel sheet, with one of the columns being from a field...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.