Solved

Using Access form to create a Mappoint 2013 data map

Posted on 2013-10-22
8
1,402 Views
Last Modified: 2013-10-27
Hello,

I have a form with five fields that is bound to a table "tblMappoint". I have button on the form that when pressed should open Mappoint and plot the data points using address, city, state, and zip. I am getting a VBA compile error: Method of data member not found on the line "rs.Edit". Any help in resolving this would be appreciated.

===================================================
Here is the fields in the table
===================================================
ID = PK
Address = short text
City = short text
State = short text
Zip = short text

===================================================
Here is the code behind the button
===================================================

Dim APP As MapPoint.Application

Private Sub Geocode_Click()

  Dim MAP As MapPoint.MAP
  Dim FAR As MapPoint.FindResults
  Dim LOC As MapPoint.Location
 
  Set APP = CreateObject("MapPoint.Application")
  APP.Visible = True
  Set MAP = APP.ActiveMap
 
  Dim rs As Recordset
  Set rs = CurrentDb.OpenRecordset("SELECT * FROM tblMappoint")

  Do Until rs.EOF = True
    Set FAR = MAP.FindAddressResults(rs("Address"), rs("City"), , rs("State"), rs("Zip"))
    Set LOC = FAR(1)
    rs.Edit
    rs!MP_Latitude = LOC.Latitude
    rs!MP_Longitude = LOC.Logitude
    rs!MP_MatchedTo = GetGeoFieldType(LOC.Type)
    rs!MP_Quality = GetGeoQuality(FAR.ResultsQuality)
    rs!MP_Address = LOC.StreetAddress.Value
    rs.Update
    rs.MoveNext
  Loop

End Sub
0
Comment
Question by:htamraz1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 400 total points
ID: 39591064
>>> Dim rs As Recordset

Try changing this to


Dim rs As DAO.Recordset
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39591068
Also make sure that you have your references set properly.

From the VBA editor:

Tools --> References

Check the box for the Microsoft DAO Object Library

Click OK to save and exit the references dialog.
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 100 total points
ID: 39591160
Also make sure the code compiles...

And just for fun move the recordset declaration to the top of the sub with the other declarations...

Sometimes the code line identified is not the actual line that has the problem.

So can you loop the table without editing anything?

Is  "LOC.Latitude" a valid value?,
I see the Latitude for NYC as both:
40° 42' 51" N
And as:
40.6700° N
So you need to be sure that what you are trying to insert is valid for this field.
(not sure if the degrees symbol is relevant or not...?)

If you hardcore a value, can it be updated?
    rs!MP_Latitude = 40° 42' 51" N
or,:
    rs!MP_Latitude = 40.6700° N

JeffCoachman
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:htamraz1
ID: 39591325
Thanks to both of you. Adding DAO did resolve the previous error; however, I have a compile error on two missing functions -- GetGeoFieldType and GetGeoQualityare.

FYI, I am adapting the code found here
http://www.mapforums.com/access-vba-programming-part-i-geocoding-mappoint-28228.html

Where would I find the these two helper functions referenced in the code:
GetGeoFieldType and GetGeoQualityare

I need them for the code to compile correctly.

Thank you again.
0
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 400 total points
ID: 39591438
Those appear to be user defined functions that you will need to either obtain or find some suitable work-around for if you need the Quality and MatchedTo fields.  (or perhaps omitting them is an option depending on your application)

I briefly looked around on the web for them, to no avail.  My best guess is that they are copyrighted functions.  From what I can tell, they were developed by Eric Frost - the author of that post - and are possibly downloadable with a membership to that site, or they may be a part of a commercial product developed by him.  

You might try contacting him directly.

Not sure what else to say here...
0
 

Author Comment

by:htamraz1
ID: 39591458
I think you're right. I posted a message on his forum to see what he has to say. I am comfortable closing the loop on this post, but let me wait for a day or so before I do that just in case he replies and I can add that to the post.
0
 

Accepted Solution

by:
htamraz1 earned 0 total points
ID: 39591942
The code for the functions
GetGeoFieldType
GetGeoQualityresult

was posted by Eric Frost at
http://www.mapforums.com/access-vba-programming-part-i-geocoding-mappoint-28228.html
0
 

Author Closing Comment

by:htamraz1
ID: 39603613
I had to research the solution for the final part of the problem
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question