I have the same exact problem. Here is my version of the code that causes the same thing. I have tried two different pda's (Trimble Juno ST and GETAC PS535F). This is driving me crazy!! Is this a bug in the software - SQL Server Compact or something?
Andy
Public Function ReturnNextLineID(strAXFFilePath, strAnimalIDValue)
'Built on the notion you are working with one animal per day
'open the selected AXF file
Dim pDS
Set pDS = OpenAXF(strAXFFilePath)
If (pDS Is Nothing) Then
Application.MessageBox "Open DataSource failed, Line 457 of Triangulation_Tools.vbs", , "WDFW Telemetry Tools"
Exit Function
End If
'Create the SQL Statement
Dim strSQL
strSQL = "SELECT MAX(LINEID) AS MAXLINEID FROM [TELEMETRYLINES] WHERE ANIMALID = '" & strAnimalIDValue & "'"
Dim pRS, MaxValue, NextValue
Set pRS = pDS.Execute(strSQL)
Application.MessageBox "SQL SENT Value =" & CStr(strSQL)
Application.MessageBox "Last Global Value =" & CStr(gblLineID)
If (Not pRS Is Nothing) Then
pRS.MoveFirst
Do While Not pRS.EOF
'If IsNull(pRS.Fields("MAXLINEID").value) = True then
If (pRS.Fields("MAXLINEID").IsNull) = True then
'
NextValue = 1
Else
'Application.MessageBox pRS.Fields("MAXLINEID").value
'What is returned here on the device is different than on the desktop, WTF?
MaxValue = CInt(pRS.Fields("MAXLINEID").value)
'Application.MessageBox MaxValue
NextValue = MaxValue + 1
End If
pRs.MoveNext
Loop
If IsNull(pRS.Fields("MAXLINEID").value) = False Then
Application.MessageBox "MAXLINEID Value =" & CStr(pRS.Fields("MAXLINEID").value)
Else
Application.MessageBox "MAXLINEID Value is evaluated to Null"
End If
Application.MessageBox "NextValue =" & NextValue
Else
Application.Message "An error Occurred Getting the LineID's", , "WDFW Telemetry Tools"
End If
pRS.Close
Set pRS = Nothing
pDS.Close
Set pDS = Nothing
ReturnNextLineID = NextValue
End Function