How to create a Textbox with a google maps link

Never Hide

Registered User.
Local time
Today, 18:03
Joined
Dec 22, 2011
Messages
96
I have a Table City with this setup
City : (ID,Name,Lat,Lon)

I also have a form with a combobox with all the fields from that table and 2 textboxes which I fill with the Lat and Lon info of the selected city.
What I'm tying to do is have a 3d textbox(named google_mapstxtbox) where I'll get a link to google maps using the Lat and Lon I get for each city. I know that you can create a link for google maps like this:
http://maps.google.com/maps?q="LAT","LON"

Now what I tried to do 1st is see if I can get the "LAT" info in the google_mapstxtbox so I tried this
Code:
Private Sub LATtxtbox_AfterUpdate()
 Me.google_maps = Me.LATtxtbox
But when I run the form nothing happened in google_mapstxtbox. I've also tried the same thing in the Change event of LATtxtbox and got the same unsuccesfull results.Also tried using the .Text , .Value properties but nothing changed.
Then I tried getting the LAT ifo directly from the combobox using in the AfterUpdate event
Code:
 Me.google_maps = CITYcmbbox.Column(4) 'the column with LAT info
And yet again I got no results.

What I had in mind for the look of the google_mapstxtbox was something like this
Code:
Me.google_mapstxtbox = "http://maps.google.com/maps?q=" & Me.LATtxtbox & "," & Me.LONtxtbox
And of course use the FollowHyperLink method after I get the text pat soted out so you can click on it and go to Google Maps:)

Maybe I'm taking a wrong approach or I'm missing something in the syntax, please help me any way you can
Thank you in advance
 
Code:
Private Sub LATtxtbox_AfterUpdate()
 Me.google_maps = Me.LATtxtbox

But when I run the form nothing happened in google_mapstxtbox.

What is Me.google_maps?

You say nothing happens in google_mapstxtbox but it looks like you are setting a control called me.google_maps, not me.googlemapstxtbox.
 
oops sry, I was typing it not copying and forgot it,sorry
I mean google_mapstxtbox
 
I don't think the after update event of the text box will fire if you set it using an after update event from the combo box.

In the after update event of the combo box, try:

Code:
Me.google_mapstxtbox = "http://maps.google.com/maps?q=" & Me.CITYcmbbox.Column(3).Value & ", " & Me.CITYcmbbox.Column(4).Value
 
I tried your code and I got an error saying "object required then I removed the ".Value" and worked like a charm :D :D
Might have something to do with the access version( i got 2003 greek) I don't know
Thank you for pointng out the answer for a newbie like me;)

P.S. "Me." isn't required for the code to run
 
One more think, could someone please be so kind as to tell me how to make the cursor to change to the typical "Over Link Cursor"? The pointing hand I mean :)
 
if you like to show u as embed in form you can use it as i did
make a form add a Browser control web
at source add this
"h ttp://maps.google.com/maps?saddr=" &
Me.CITYcmbbox.Column(3) & "&daddr=" & Me.CITYcmbbox.Column(4) & "&iwloc=A&output=embed&hl=el "
now to change pointer and add hand ...
 

Users who are viewing this thread

Back
Top Bottom