Community of VE/MapPoint Users and Developers
This is a discussion on query shape produces wrong results within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I am working on the following code to select pushpins graphically. I prefer not to send the data to Excel. ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| query shape produces wrong results This is the code: Private Sub mnuSelectRectangle_Click() Dim intShapes As Integer Dim longHeight As Long Dim longWidth As Long Dim longTop As Long Dim longLeft As Long Set objMap = MappointControl1.ActiveMap longHeight = objMap.SelectedArea.Height longWidth = objMap.SelectedArea.Width longTop = objMap.SelectedArea.Top longLeft = objMap.SelectedArea.Left objMap.SelectedArea.SelectArea longTop, longLeft, longWidth, longHeight Set objLoc = objMap.SelectedArea.Location If longHeight = 0 Or longWidth = 0 Or longTop = 0 Or longLeft = 0 Then MsgBox "Nothing selected. " Exit Sub End If Set objShape = objMap.Shapes.AddShape(geoShapeRectangle, objLoc, CDbl(longWidth), CDbl(longHeight)) objShape.Select MsgBox "The type of shape selected is " + CStr(objMap.Shapes.Item(1).Type) Set objDataSet = objMap.DataSets.Item(2) If objShape Is Nothing Then MsgBox "objShape got lost" End If Set objRecordset = objDataSet.QueryShape(objShape) ' Loop over records and place the captured pushpins in a list box objRecordset.MoveFirst intShapes = 0 Do While Not objRecordset.EOF frmSelectAccounts.lstAccounts.AddItem objRecordset.Pushpin.Name objRecordset.MoveNext intShapes = intShapes + 1 Loop MsgBox "Number of records in shape: " + CStr(intShapes) frmSelectAccounts.Show End Sub
__________________ David Kachuck dk0146@netscape.net Oracle Certified Professional Database Administrator (OCP) MS Access Certified Expert (MAUS) |
| ||||
|
David, I think this sample I posted might help? Orignal post: http://www.mp2kmag.com/mappoint/disc...pic.asp?t=3327 Quote:
Code: Private Sub Command1_Click() On Error GoTo error: Dim objmap As MapPointctl.Map Set objmap = MappointControl1.ActiveMap Dim sa As MapPointctl.SelectedArea Set sa = objmap.SelectedArea Dim objDataSet As MapPointctl.DataSet Dim objRecords As MapPointctl.Recordset Dim objLocs(1 To 5) As MapPoint.Location Set objLocs(1) = objmap.XYToLocation(sa.Left, sa.Top) Set objLocs(2) = objmap.XYToLocation(sa.Left + sa.Width, sa.Top) Set objLocs(3) = objmap.XYToLocation(sa.Left + sa.Width, sa.Top + sa.Height) Set objLocs(4) = objmap.XYToLocation(sa.Left, sa.Top + sa.Height) Set objLocs(5) = objmap.XYToLocation(sa.Left, sa.Top) 'Remove the comment from the next line to see the polygon being queried 'objmap.Shapes.AddPolyline objLocs lngCount = 0 For Each objDataSet In objmap.DataSets Set objRecords = objDataSet.QueryPolygon(objLocs) objRecords.MoveFirst Do While Not objRecords.EOF lngCount = lngCount + 1 objRecords.MoveNext Loop Next MsgBox "Number of records in polygon: " & lngCount Exit Sub error: MsgBox Err.Description End Sub
__________________ John http://www.support-pc.com Order MapPoint 2006 Here https://secure.mp2kmag.com/?refer=support-PC |
| |||
| select pushpins graphically
Thanks. That works. I don't really understand (yet) why my query shapes solution doesn't work, but hey, why blow against the wind?
__________________ David Kachuck dk0146@netscape.net Oracle Certified Professional Database Administrator (OCP) MS Access Certified Expert (MAUS) |
![]() |
| Tags |
| produces, query, results, shape, wrong |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Does an object reside in my Shape or Shape boundaries? | hotrdd | MapPoint 2006/2009 Discussion | 1 | 08-04-2005 10:51 PM |
| Linking access query results to MPC | Anonymous | MapPoint 2006/2009 Discussion | 0 | 06-22-2004 12:25 PM |
| Query by shape / polygon | blackmap | MapPoint 2006/2009 Discussion | 7 | 02-12-2003 04:35 AM |
| reverse geo coding, results wrong | Anonymous | MapPoint 2006/2009 Discussion | 2 | 09-22-2002 10:11 AM |
| I have a J++ web application that produces reports.... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 11-17-2000 07:39 AM |