Runtime Error Handling in ArcPad

429
0
10-21-2016 02:59 PM
IngridHogle
Occasional Contributor

Does anyone have any vbscript error handling routines that have worked for them in ArcPad that you might be willing to share?

I am getting runtime failures on the line pRS.Update() when trying to update text and domain fields in pre-existing features, but this only happens maybe 5% of the time and is completely inconsistent and nearly impossible to replicate in the office. This is using an axf checkout and ArcPad 10.2.2.

Here is an example of my attempt to integrate error handling ('Error handling attempt) below, but I have been unable to recreate the runtime error in order to test if it works.

Sub CalcAndSetSymbology(p_pRS, p_lBookmark)

'++ IH added to try to troubleshoot 8/23/16
    If (Map.SelectionLayer Is Nothing Or 0 = Map.SelectionBookmark) Then
        Application.MessageBox "Please tell GIS Manager that line apsym updates are not working because ArcPad doesn't know you have a line feature selected.", apCritical, "Bad Code"
        Exit Sub
    End If

    '++ point to record
    p_pRS.Bookmark = p_lBookmark
    
    '++ get the key values
      Dim sNewApsymValue
      Dim sTSRecord, sTSFID, sSPPFID, sSPPFINAL
      sTSRecord = p_pRS.Fields(FIELD_TSRECORD).Value
      sTSFID = p_pRS.Fields(FIELD_TSFID).Value
      sSPPFID = p_pRS.Fields(FIELD_SPPFID).Value
      sSPPFINAL = p_pRS.Fields(FIELD_SPPFINAL).Value
 
    Dim sNewSppSymValue
      '++ calc sppsym value
      sNewSppSymValue = ""
    sNewSppSymValue = GetSPPSymValue(sSPPFINAL, sTSFID, sSPPFID)

      '++ calc apsym value
      sNewApsymValue = ""
      If (IsNull(sTSRecord) Or "" = sTSRecord Or "Blank" = sTSRecord) Then
          If (IsNull(sTSFID) Or "" = sTSFID) Then
              sNewApsymValue = sNewSppSymValue
          Else
              sNewApsymValue = sTSFID
          End If
      Else
          If ("Not Spartina" = sTSFID) Then
              sNewApsymValue = sTSFID
          ElseIf ("Not Treated" = sTSRecord Or "Not Treated (need airboat)" = sTSRecord Or "Unknown" = sTSRecord Or "Other" = sTSRecord Or "Looks Not Treated" = sTSRecord Or "Probably Not Treated" = sTSRecord Or "foliosa" = sTSFID Or "unknown alt hybrid" = sTSFID) Then
              sNewApsymValue = sTSRecord & " " &  sTSFID
          Else
              sNewApsymValue = sTSRecord
          End If
      End If

'Error handling attempt
    on Error Resume Next

      '++ apply changes
      p_pRS.Fields(FIELD_APSYM).Value = sNewApsymValue
      p_pRS.Fields(FIELD_SPPSYM).Value = sNewSppSymValue
      p_pRS.Update()

    If Err <> 0 Then
        MsgBox "apsym did not update"
        Err.Clear
    End If

    Call UpdateLinkedBuffer(p_pRS, p_lBookmark)

End Sub

0 Kudos
0 Replies