I have a custom ArcPad form, which includes the geography tab. Users use this tab to update coordinates using the GPS. When user press OK in the edit form, I want to first check that they have not moved the coordinates of a point beyond a set distance. However, when I try to get the coordinates in VBS, from an event, it does not give me updated coordinates, only the coordinates that existed when the form was opened!

Here is the VBS Sub to grab the coordinates:

Sub SubCheckCoords()

  Dim msg
  Dim newXC, newYC, newZC
  newXC = EditForm.Fields.Shape.X
  newYC = EditForm.Fields.Shape.Y
  newZC = EditForm.Fields.Shape.Z

  msg = "NEW X "&newXC&" Y "&newYC&" Z"&newZC

End Sub

Does anyone have any pointers on how to get the current coordinates that are stored in the geography tab - before the form is closed?


I've used the onFeatureAdded event and added code to pick up the coordinates using the thisevent.layer.name and thisevent.bookmark

strTempLayer = thisevent.layer.name
application.map.layers(strTempLayer).records.bookmark =  thisevent.bookmark
set tempShape= application.map.layers(strTempLayer).records.fields.shape
application.map.layers(strTempLayer).records.fields("XVal").value = tempShape.x
application.map.layers(strTempLayer).records.fields("YVal").value = tempShape.y
application.map.layers(strTempLayer).records.fields("ZVal").value = tempShape.z

Alternatively(Just adding I have just found from some old code..) which would validate that a field was edited.

if len(thisevent.object.pages("PAGE1").Controls("fieldname").value)= 0 then
    do stuff
end if
  • Thanks for that - It seems that is the only way I can pick up the new coordinates. However, once the form is closed it is later than I wanted, since I want to warn the user about the distance the new point is from the old one. – Nick And3rs0n Mar 29 '15 at 23:16
  • You could use the GPS.x and GPS.y which would be inherently different to what is stored but they are always accessible.. – woodwa Mar 30 '15 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.