jonesjes

Calculator: General Error / VBA Migration Issues

Discussion created by jonesjes on Aug 29, 2011
I've included some code below that's meant to calculate decimal degrees from dms degrees.  I suspect the problem is somewhere in the "preexpression" but I'm still new to VB.net/VBScript syntax.

Unfortunately our IT dept. pushed the new Arc before we had a chance to fully migrate scripts to 10 compatable, so I'm on a time crunch!!

Thanks in advance.

''''Start AddPointDDValues
MsgBox "Starting AddPointDDValues"
Set pFCursor = pFClass.Update(Nothing, False)
Set pCalc = New Calculator
With pCalc
      Set .Cursor = pFCursor
      .PreExpression = "Dim pPt as IPoint" + vbCrLf + _
                             "Dim dX as Double" + vbCrLf + _
                             "Set pPt = [Shape]" + vbCrLf + _
                             "dX = pPt.X"
       .Expression = "dX"
       .Field = "LONG_DD"
       .ShowErrorPrompt = True
       .Calculate
End With
Set pFCursor = pFClass.Update(Nothing, False)
Set pCalc1 = New Calculator
With pCalc1
       Set .Cursor = pFCursor
       .PreExpression = "Dim pPt as IPoint" + vbCrLf + _
                              "Dim dY as Double" + vbCrLf + _
                              "Set pPt = [Shape]" + vbCrLf + _
                              "dY = pPt.Y"
       .Expression = "dY"
       .Field = "LAT_DD"
       .ShowErrorPrompt = True
       .Calculate
End With

Outcomes