From: Wayne-I-M on 6 May 2010 17:01 Hi Mohamed here is a copy of an answer I gave a while ago to the same type of question It this is not what you're looking for post back and I (and other on this forum) will try to help I came up with this code myself so there maybe better methods (almost certainly) around but you are free to use this code if you want Good luck ________________________________________________ Create a new form in design view. Put 1 button on it (call it butGMaps ). Put a text box on the form (call it txtCodesPostle). Load this into the OnClick event of butGMaps Private Sub butGMaps _Click() Dim MyHyperlink As String Dim strGoogleLoaction As String strGoogleLoaction = Replace([txtCodesPostale], " ", "+") MyHyperlink ="http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q=" & strGoogleLoaction & "&ie= UTF8&ll=45.447125,6.978335&spn=0.012796,0.043087&z=15" Application.FollowHyperlink MyHyperlink End Sub As you can see this is almost the same as I posted to you in another post. But (again following Larry Linson's advice) you would be better understanding this code – so you can create your own. So lets break down the code and work out how to create your own Google Maps pointer. This section just tells your application to do something when you click a control (in this case butGMaps ) Private Sub butGMaps _Click() This section is used to define the 2 variables. Dims are used to dinfine variables and can be used elsewhere in the form (or in the application if used in a public module) Dim MyHyperlink As String Dim strGoogleLoaction As String So MyHyperlink and strGoogleLoaction can be changed (which is what variable means in English – I may wrong about the translation. If I am someone else will tell you) This section tells your application to “follow” (go to) the place that you have declared in your DIM variable Application.FollowHyperlink MyHyperlink This is the section that some people who are new to Access and Google Maps have problems with strGoogleLoaction = Replace([txtCodesPostale], " ", "+") MyHyperlink ="http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q=" & strGoogleLoaction & "&ie= UTF8&ll=45.447125,6.978335&spn=0.012796,0.043087&z=15" So we can break it down strGoogleLoaction = Replace([txtCodesPostale], " ", "+") This section replaces spaces (if there are any) with a + sign. This is important as HTTP code (like used in Google Maps) will replace spaces with % and not a +. But of course if there are no spaces then it will not do anything The next section (which in your code should all be on one line) MyHyperlink ="http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q =" & strGoogleLoaction & "&ie = UTF8&ll=45.447125,6.978335&spn=0.012796,0.043087&z=15" Is actually 4 sections This section tells your application that this is the variable hyperlink MyHyperlink = This section open Google Maps (and a few other things like setting the Geocoded time – for more info on this search Google on Geocode) http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q This section inserts the variable you have put into your text box & strGoogleLoaction & "& This section tells Google Maps “which” maps to open and at what scale UTF8&ll=45.447125,6.978335&spn=0.012796,0.043087&z=15 THAT IS THE SECTION YOU NEED TO CHANGE if you need another map – "not" the post code, zip code, codes postle, etc So let say you live in the USA and you want to open a map of New York Here is a cheat you can use that is very simple If you open Google Maps and zoom in to the New York area then select the "Link to this page" icon you can cut this http://maps.google.co.uk/maps?hl=en&ie=UTF8&ll=40.784701,-73.861084&s... You then cut out the section of this hyperlink “includeing and all after the UFT" (Unicode Transformation Format) so you will get this UTF8&ll=40.784701,-73.861084&spn=0.883826,2.757568&z=9 For Paris you would have this UTF8&ll=48.819524,2.406006&spn=0.38429,1.378784&z=10 For the whole of Italy you would have this UTF8&ll=42.455888,13.425293&spn=6.888257,22.060547&z=6 You need to add this section to your code so it looks like this (for New York) Private Sub butGMaps _Click() Dim MyHyperlink As String Dim strGoogleLoaction As String strGoogleLoaction = Replace([txtCodesPostale], " ", "+") MyHyperlink ="http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q=" & strGoogleLoaction & "&ie= UTF8&ll=40.784701,-73.861084&spn=0.883826,2.757568&z=9" Application.FollowHyperlink MyHyperlink End Sub Or like this for paris Private Sub butGMaps _Click() Dim MyHyperlink As String Dim strGoogleLoaction As String strGoogleLoaction = Replace([txtCodesPostale], " ", "+") MyHyperlink ="http://maps.google.co.uk/maps?g=q&hl=en&geocode=&time=&date=&ttype=&q=" & strGoogleLoaction & "&ie= UTF8&ll=48.819524,2.406006&spn=0.38429,1.378784&z=10" Application.FollowHyperlink MyHyperlink End Sub Don't forget that if you insert a post code, zip code, codes postle that is not on the map it will not be seen as it is out side the area. I hope this helps you with you application -- Wayne Manchester, England. "Mohamed Gharabli" wrote: > hi all, > > i have a ms access database and i want to like it with google maps. and i > have to let the use to zoom in and zoom out. > > please advice
First
|
Prev
|
Pages: 1 2 Prev: Subform with selected item Next: Access 97 and 2007 on the same machine |