473,372 Members | 1,085 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,372 software developers and data experts.

Using Google Maps In MS Access

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. Size the form to your
liking...

On the blank form, go to the "Insert" menu and select "ActiveX
Control..."

When the selection screen appears, choose "Microsoft Web Browser".

Once the control object has been placed on your form, resize the
control object WITHOUT SAVING THE FORM. The reason for this? Once you
save the form, if you want to resize after saving you have to delete
the control object and re-insert a new Microsoft Web Browser ActiveX
control object each time you want to resize it.
In this example, I have named the control object WebBrowser0.

I recommend inserting a command button named cmdClose for testing
purposes.

Once you have the Design View finished,...

a.) Set the TimerInterval for the form to 1000
b.) Go to the View menu option.
c.) Click on Code.
d.) In the Code Module for the form, insert the following code.

=<BEGIN>========================================== ===============

Option Compare Database

Private Sub cmdClose_Click()

Me.TimerInterval = 1000
MyAssigned = False
Set objBrowser = Nothing
DoCmd.Hourglass False
DoCmd.Close acForm, "frmGoogleMap", acSaveNo

End Sub

Private Sub Form_Timer()

'Declare variables.
Dim objBrowser As Object

'Set variables.
Set objBrowser = Me.WebBrowser0

If MyAssigned = False Then
DoCmd.Hourglass True
With Me.WebBrowser0
.Navigate MyGoogleMapURL
Do Until .ReadyState <> 3
DoEvents
Loop
DoEvents
Do Until .ReadyState = 4
DoEvents
Loop
DoEvents
MyAssigned = True
End With
DoCmd.Hourglass False
End If

End Sub

=<END>============================================ ===============

Save and close the new form naming it "frmGoogleMap".

==============
== STEP TWO ==
==============

Go to the Modules section of your MS Access database, and click New and
insert the following code.

=<BEGIN>========================================== ===============

Option Compare Database

Global MyAssigned As Boolean
Global MyGoogleMapURL As String

=<END>============================================ ===============

Save and close the new module naming it "Google Variables".
At this point, I will show you how Google Maps structures the URL that
retrieves a requested map.

Let's say you want to search for :

John Smith
111 West Gable Lane
Dayton, OH 45410

When you go to Google Maps at http://maps.google.com, you type in the
address and Google goes to...

"http://maps.google.com/maps?q=111+West+Gable+Lane+Dayton+OH+45410&iwloc=A &hl=en"

Now to pass this value to your new form, set your MyGoogleMapURL
variable to the above URL and open the new form like this:

MyGoogleMapURL =
"http://maps.google.com/maps?q=111+West+Gable+Lane+Dayton+OH+45410&iwloc=A &hl=en"
DoCmd.OpenForm "frmGoogleMap", acNormal

Obviously, you can parse the string value of the URL to any address of
your choosing.

Programmer's Note(s) And/Or Warnings:

If you're connecting to your new Google Maps form through a Citrix
connection, the opening of the Microsoft Web Browser control will crash
your MS Access database. This is because Google Maps will turn your
SpeedScreen setting on in Citrix, even if you have it set to Off, and
the combined running of both creates a GPF error.

You CAN, however, use a standard Remote Desktop Connection(RDC) or a
VNC connection with no resulting crashing of MS Access.

For additional business purposes, you can also have your MS Access
application target different types of businesses nearby (Example :
Schools) just by setting the URL string value to something like...

"http://maps.google.com/maps?q=schools+loc%3A+111+West+Gable+Lane+Dayton+O H+45410&f=l&hl=en"

I hope this helps you in your development process.

If you have any questions, feel free to contact me at:

Sean Dorman
se*********@yahoo.com

Nov 13 '05 #1
3 60958
I almost forgot to mention...the difference between showing the map in
"Satellite" view, as opposed to the "Map" view, is in how you end the
URL sent to the Google Map form you have created.

The "Map" view URL ends like this...
"...+fresno+ca+93711&iwloc=A&hl=en"

The "Satellite" view URL ends like this...
"...+fresno+ca+93711&t=k&iwloc=A&hl=en"

Again, I hope this helps.

Sean Dorman
se*********@yahoo.com

Nov 13 '05 #2
Haven't tried it yet, but the concept sounds very good.

Thanks.

--
Darryl Kerkeslager
Nov 13 '05 #3

Sean wrote:
Once the control object has been placed on your form, resize the
control object WITHOUT SAVING THE FORM. The reason for this? Once you
save the form, if you want to resize after saving you have to delete
the control object and re-insert a new Microsoft Web Browser ActiveX
control object each time you want to resize it.


I find that this code sizes (for width) my browser control quite
satisfactorily:

Private Sub Form_Open(Cancel As Integer)
Me.wbHDSBHelp.Width = Me.Width
End Sub

I think we are talking about the same control? Perhaps, I am
misunderstanding.

Nov 13 '05 #4

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

Similar topics

6
by: Sam Carleton | last post by:
Ok, over the years I have read about doing web programing and I have done some real basic stuff. Now I am digging into some real ASP.Net 2.0 and am totally lost some things. I have a master...
17
by: MeerkatInFrance | last post by:
There comes a time when you know you are not going to be able to work something out yourself, however hard you try. I have reached that moment. I have a master page and a slave page (or whatever...
0
by: jbarbeau | last post by:
I have a VB.net database for storing points and information about them using Google Maps. I need to encode these points using the Google API in Javascript. I made functions to pass the data on...
4
by: phanimadhav | last post by:
hai this is sudheer.I don't know how to use googlmaps .I am serching in net but its not working in my application one error was occur at the executionTime Objectexpected.This is the url ...
0
by: joaorbraposo | last post by:
Hi! I'm creating an application using C# and I need to display one or more markers in a webBrowser object using Google Maps. The problem is that I was thinking to create only one HTML file...
1
by: Anthony2oo5 | last post by:
Iv been searching for a way to get the distance in miles from one location to another, and thought the best way is using google maps. Back in the day I did this by using a curl command and regular...
4
omerbutt
by: omerbutt | last post by:
hi there i need to use google maps to show my location on my contact us page ,havent done that that before ever any help or guidance will be appreciated ,i some how read somewhere that we need to...
6
by: mfaisalwarraich | last post by:
Hi everyone, I am trying to add multiple pinpoint to google map using Lon/Lat. All addresses will be fetched from mysql database using PHP. I have looked at google and searched for it on...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.