Solved

Using Access form to create a Mappoint 2013 data map

Posted on 2013-10-22
8
1,309 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
  • 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
 

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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now