Polling the Google Maps API from VBA - possible?

Hi all,

I want to integrate Geocoding into an Access file, but I'm not sure if this is even possible. I honestly do not know much about Web programming, so I might be missing something fundamental.

Here's a document detailing how to get geocoding information from Google Maps using HTTP:

Any pointers you can give me on how to approach this would be great. Or just telling me that there's no way to accomplish this from within VBA


Post your answer or comment

comments powered by Disqus
is their a way to create multiple google map markers on an embedded browser within a form just by altering the url thats passed to it

their are solutions but all seem to work only if you running the google map api which im not

Hello! I'm looking to create a google map link from a table- the table will have numerous entries that will all need to be added to the google map. Fields (for example) are address, city, state, zip and I'm looking to create the map through a form button with vba code. If someone could tell me how to go about this, I would greatly appreciate it. Thanks so much...


I have an Access Database where I have a textbox on a form where the user types in a postcode.

I have a webpage written in HTML that has a textbox where the user types in a postcode which retrieves a Map for the postcode using the Google Map API.

What I need to know is, can I get the contents from the Access TextBox and export it to the TextBox on the on the webpage using some kind of QueryString.

I know how to open the Webpage within my Access Form but I just need some clues on how to pass the contents of the string so that the user does not have to enter the postcode twice.

Many Thanks for any ideas however small



I was admiring the Google Maps application here http://www.access-programmers.co.uk/...le+Maps+access posted by ChrisO and was wondering how I can add my new streets and locations in Zambia, Africa.

I tried to locate local a few places but could not get specific or no required results at all.

I will appreciate.

I recently added a function to my DB that calculates road miles between two zipcodes using the Google Maps API.

That part is working great however I wanted to cache the results in a table so the code doesn't have to go out into the internet every time.

Every time the SQL insert statement fires I get the following:
Error #: 2486|Error Desc:You can't carry out this action at the present time.

I think it's because I'm using the function in a query to calculate multiple zip codes at once and the table or the DB is getting locked up but I can't seem to be able to overcome it

Thanks in advance for any help anyone can provide!

Hello :-)

I'm programming with accesss 2003 a few lines and I have an issue with the wbbWebsite Activex (wbbWebsite.Navigate URL:=Weblink). I build a database with 6000 postal codes, yes another postal code question... But not the usual one! I'm calling a google map based on the postal code choosed by the user, but everytime that I'm doing so, it seems that in the background a new instance of IE7 is opened and therefore, increasing the page file memory used.

I know that there is a "Unload" in the Google Maps API, but like I said, I'm using the ActiveX wbbwebsite. Is there a few lines of code that could kill the actual web browser instance opened, before loading a new one?


Hi Everyone,
Hope you can help and thanks in advance for any replies.

I have a DB for our Church Hamper Service and I need to be able to check addresses using Google maps or something similar, I have searched the Forum but can't find what I need. Using MS Access 2010

I want to be able to lookup the addresses of a client but find a route, we just need to confirm the address as we are a fixed point i.e. everything is sent from us.

Also want to keep as simple as possible as some of the volunteers are not computer literate.

The DB will be used by up to 8 people per month and I have checks in place to stop any deletions etc.


Dear all,

I need some help and advice using VBA to create a URL.

I want to plot several points on Google Maps. The URL I am trying to create is this:-






String (ending):-


This plots three points on a map. I have created the above manually but I can't figure out how to get access to create it. I have a table that stores address/postcode data:-


LS11 8QY
LS11 7HG
LS10 1AZ

How do I turn the three postcodes (above) into the url above using vba?

It's basically a string function but I do not know how to loop(?) the three records into one continuous string. I have searched and searched but I can't find the answer. Any help or guidance would be greatly appreciated.


Hello, I was wondering if it's any way possible to capture image of google maps somehow (based on link or address) and have the image pasted into my word document via vba that's also generated inside the database which fills couple of fields on word template file and saves it to specific folder.



I'm currently working on a small database for my company containing a list of suppliers/services and their information. One of the information fields is a distance field, which allows people in the company to search for approved suppliers/services within a certain distance from the company.

I actually have working code for this using both Bing Maps API and Google Maps API. Basically, I have a button with a VBA script that reads in an address from the table, accesses Bing API, extracts the distance from the generated XML file (if it fails to find one, run Google API) and puts it into another field in the table. It will only try to get a distance if there isn't already one. The problem is this implementation breaks ToS for both Microsoft and Google since
1) the application works over an intranet and is not accessible on a public website,
2) it uses an automated script
3) it does not display Bing Maps or Google Maps.

So my question is simply this: Does anyone know of another API or some other method for getting distances between two addresses where I wouldn't be breaking any ToS. Or, is Microsoft/Google likely to even notice/care since I only have 300 records in total and there probably won't be any massive additions?

I want to add a field to my access form which is linked to Google Map with our office location set as default location and the field will shows mileage to the client address.
I know I can use a code to link to google map, but all I am interested in is the mileage # from our location to the client location.
Thanks in advance

I have just posted a blog in MS Access hints and tips here: Sending Google Mail (Gmail) from MS Access, VBA, Excel, Word...

Escape From Outlook
Microsoft tightly combine their applications together however sometimes it’s nice to escape from Microsoft Products and use others. Here I demonstrate how you can use Google Mail to send out an e-mail from an Internet connected PC, and you can also do this covertly!
This Example is From:
Windows® XP Under the Hood, Pg. 266 Chapter 6 Messaging and Faxing Objects
This basic example sends a simple, no-frills text message every time the script is run: Example File: script0603.vbs As you can see, the original file was a VBScript file; I have converted this to VBA.

Google e-mail Account
I have also set up a Gmail account to send the emails through. You are welcome to use this account for testing, however I suggest you set up your own Gmail account and change the hard coded information where necessary if you intend using this code for your own purposes.

Gmail From MS Access (the Video)
Can't show the video here!

Text from the above Video
This video is of a demo MS Access database which shows you how to send an e-mail from Google mail using
VBA. Press the “Send a Test Email” button and wait and then you get this message saying that the message sent is "True". It doesn't necessarily mean the message has been sent, it just means the code operated successfully. It is not necessary to have that confirmation message appear, this can be hidden, hence you have the ability to send email from your application covertly!

Hi Guys,
is it possible to have a textfield, and when i enter data will grab the addresss from google maps, with autocomplete... not showing maps, only address

Let me know

I am trying to update a check box on the form from VBA code and it is not happennig. The code is as follows:

	DoCmd.RunCommand acCmdRefresh
DoCmd.SetWarnings False
Dim rs As New ADODB.recordSet
Dim strSql As String
Dim cmd As ADODB.Command
Dim Userid As String
Dim NewUser As String
Dim count As Integer
Dim currentDate As String
Dim clientMessage As String
Dim clientSubject As String
Dim cm1 As String
Dim cm2 As String
Dim cm3 As String
Dim invheader As String
Dim e As String
Dim flag As String
Dim con As ADODB.Connection
Set con = New ADODB.Connection
con = CurrentProject.Connection
e = Chr$(13)
flag = True
currentDate = CStr(Date)
Userid = [Forms]![FRM_Shippers_Past_Due]![Userid]
    strSql = "SELECT [TBL_E-Mail_Shippers].E_Mail_Sent, [TBL_E-Mail_Shippers].Select,
             "TBL_Select_Shippers.* " & _
            "FROM [TBL_E-Mail_Shippers] " & _
            "INNER JOIN TBL_Select_Shippers ON [TBL_E-Mail_Shippers].CTC_SYS_NR = TBL_Select_Shippers.CTC_SYS_NR " & _
            "WHERE ((([TBL_E-Mail_Shippers].[Select])=-1) AND (([TBL_E-Mail_Shippers].Network_ID)= " & "'" & Userid & "'" &
            '"WHERE ((([TBL_E-Mail_Shippers].E_Mail_Sent)=0) AND (([TBL_E-Mail_Shippers].[Select])=-1) AND
    count = 0
    rs.Open strSql, CurrentProject.Connection
    Do While Not rs.EOF
 'string extraction
        If rs!E_Mail_Sent = 0 Then
            Call FnTestSafeSendEmail(collectorEmail, EmailSubject, clientMessage, supervisorEmail, BCCEmail)
            [Forms]![FRM_Shippers_Past_Due]![E_Mail_Sent] = -1
            count = count + 1
       End If
        MsgBox CStr(count) & " records emailed"
    Set rs = Nothing   
End Sub

I am trying to update the field [Forms]![FRM_Shippers_Past_Due]![E_Mail_Sent] = -1 once the email is sent.

[Forms]![FRM_Shippers_Past_Due]![E_Mail_Sent] updates [TBL_E-Mail_Shippers].E_Mail_Sent

[TBL_E-Mail_Shippers].[Select] gets the input from the form.

User updates this field form the from to select the records to be emailed.

Right now its only updating only one record and I want to update multiple records. Thanks

Is it possible to control the default value of a table from within VBA?

I have a field in a table that requires a different default value, depending on where the database is being used. However I want to make it as easy as possible to for the user to change this value (within bounds).

I have a table that holds a single record, the potential default value for a number of other records in other tables. Can I retrieve this data and use it as the default value for these other tables, either in a form or on opening the database?

Alternatively, is it possible to control the defaul value of tables at the most basic level? E.g: I know that it is possible to create or modify a table using SQL, but it is possible to set the default value of a table using SQL too?

I figure that using the SQL route (if at all possible) would be the easier but I am not experienced enough in either SQL or VBA to know where to start on either option.



Is it possible to call from VBA access a webservice over a network?

I export from Access an XML file which is put on a server on the network. When it stays there I have to trigger a webservice on the server.

Can somebody help me with this?

Thanks in advance.


hi all
we have a query that produces a lot of delivery address all over the uk
and we are trying to map these on google maps from the postcode in the query
any ideas

i have seen a lot of websites using the method to show where there other office and members are etc..



I've seen forms before where they can show you a google map using the address data in the table to display the location

however, the ones ive seen, (about 4 or 5 different versions), only do it one by one.

I have a list of 1000 Postcodes and addresses, I need to export a google map with them all on pin pointed, is this possible?

It's something we need to do to see marketing coverage, and I dont want to do each address one by one!

After my post in the general forms (titled thank you) this Post might contradict me - You see after introducing myself I expressed that I've never had to post a topic because up to now all my questions have been answered, and I found the answer by using the search function. But now I'm afraid that I'm going to ask a question which looks to have been answered, but I am afraid I am not able to follow.

I would like to know how to add a Hyper link in my form linking the Post Code to Google Maps so that Google Maps shows the location of the post code


This may be to difficult for access to do BUT I would like it so when I click my post code (or a button linked to the postcode) it opens Google Maps and shows directions from my company's Workshop to the Post code in question


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:

Now what I tried to do 1st is see if I can get the "LAT" info in the google_mapstxtbox so I tried this

	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

	 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

	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


I have an "After Update" event procedure for a field on a form that calls a VBA sub. When I use a different VBA sub to input a value in the above mentioned field, the "After Update" event does not occur, even thought the data in the field has been changed. (Of course if I manually enter the data, the field "After Update" event works.)

Is there a flag or condition that needs to be set in my VBA sub to let the field realize that it has been changed? Or possible a way to call the fields AfterUpdate Sub?

I tried having a my sub call the AfterUpdate sub to see what would happen, but didn't get it to work. I got a bunch of error and didn't feel like this was really the way to go.

I also could just duplicate all the code in the AfterUpdate sub for the field, but we all know that that is not a good idea.

Thank you for any help.

Well, it appears that the ‘powers that be’ are not in the remotest bit interested in servicing this thread or the Sample Database Forum for the average user.
(They can and have for themselves but not for us mere mortals.)

And so I will make a suggestion; let’s post our Sample Databases in this Forum instead.

That way we can see what’s being held up through inaction and, in the meantime, other members may put them to some use.

So, here’s my first example as it should have appeared in the Sample Databases Forum: -

G’day all.

Attached is a small Access 97 database for storing and viewing the Google Maps™ maps and street views system.
(Tested from A97 to A2K7)

Once addresses are stored in the database provisions are made to…
1. Ask Google to plot the directions from a start address to a destination address, with waypoints.
2. Ask Google to display the street view of the start address, select as required
3. Email the direction information and URL to a contact.
4. Email the street view information and URL to a contact.
(The Email facilities require Microsoft Outlook and will not work with Outlook Express.)

Please note that not all paths between addresses can be resolved, usually due to water ways between them.
If this happens and the destination address is within the USA you should see a central USA map displayed.
Similarly, if an unresolved destination address is within Australia then you should get a map of Australia.

Plots between Australia USA may be resolved via Japan but it does seem to require a certain amount of rowing.

Please view the online help for the method of use.

As always, have fun with it and regards,

Now that wasn’t too hard was it?

So now please everyone, post your submissions in this Forum so that even if the ‘powers that be’ take no action then at least the other members of this site may profit from them. (I think that was the intention of this site and hopfully it still is.)
But if any administrator or moderator wants to reply to this thread then could they please say why they have not addressed this issue before now.


I am trying something new in my database in that I would like to call ALL or at least most of my queries from VBA.

I have managed to test that out with my first query successfully, however I get the error 3326 - this record is not updateable when I use the code. In the current state the user would need to End or Debug, which I would like to suppress if possible.

Is there a problem with calling SQL code from VBA that can't be updated? It seems to me just a normal result of some query strucutres.

Thank you to anyone who can offer advice or solutions.


I'm currently creating a report generation database in Access 97. These reports must be printed for several levels of management, reporting on financial information for each client that person in that management role is overseeing.
Each individual report has 5 pages. Some of the pages may have no information on them based on the services our clients purchase from us. I use a process in VBA to determine beforehand if the data being returned to the report is null or not. To save paper and improve the appearance of the reports, these pages must be removed for printing. I cannot do this as I originally planned by using the Sorting and Grouping. I was programmatically changing the sorting to the management title so it would sort by the names in that field. This caused the reports to only print one client per management person.
To sum it up, I need a way to suppress a page based on criteria from VBA without using Grouping and Sorting on the report.

Not finding an answer? Try a Google search.