problems with queryshape

chas
09-08-2006, 10:20 AM
Trying to return all pushpins in a shape with 3 datasets on map. As i iterate through the shapes I get the same count of "3" regardless of how many pushpins are in shape . . . what am i doing wrong?

tshapes = objmap.Shapes.Count
Do While tshapes <> 0
Set objshape = objmap.Shapes.Item(tshapes)
objshape.Select
Set objrec = objdata.QueryShape(objshape)
MsgBox Str(objdata.RecordCount)
objrec.MoveFirst
reccount = 1
Do While Not objrec.EOF
reccount = reccount + 1
Loop
msgbox reccount
tshapes = tshapes - 1
Loop

Wilfried
09-08-2006, 01:52 PM
Hi,

The first messagebox will popup (with the record count I assume), but then your code runs forever in the second loop because you dont increment the cursor in the recordset. You have to call MoveNext in the second loop. Or there is no record and the result is already EOF.

 
Web mp2kmag.com
mapforums.com