I am using this code to log errors:
I am having one issue the BuildNum keeps going into the table as 0. I added this to a Watch Window and the right figure comes out in the Watch Window:
I have tried both Text and Integer as the Field types in the table. What am I doing wrong?
Code:
Sub LogError(strSub As String, lngErrCode As Integer, strErrDesc As String)
Dim cnn As ADODB.Connection
Dim strSQL As String
Set cnn = CurrentProject.Connection
strSQL = "INSERT INTO tblLog (ErrorNum, ErrMessage, UserName, ErrTime, BuildNum, CurrentSub) "
strSQL = strSQL & "VALUES ( " & lngErrCode & ", '" & strErrDesc & "', '" & strUserLogin _
& "', #" & Date & "#, " & DLookup("[VersionNum]", "tblVersion", "[VersionID] = 1") & _
Format(DLookup("[VersionMinNum]", "tblVersion", "[VersionID] = 1"), ".00") & _
Format(DLookup("[BuildNo]", "tblVersion", "[VersionID] = 1"), ".00") & ", '" & strSub & "' ) "
cnn.Execute strSQL, , adExecuteNoRecords
End Sub
I am having one issue the BuildNum keeps going into the table as 0. I added this to a Watch Window and the right figure comes out in the Watch Window:
Code:
DLookup("[VersionNum]", "tblVersion", "[VersionID] = 1") & _
Format(DLookup("[VersionMinNum]", "tblVersion", "[VersionID] = 1"), ".00") & _
Format(DLookup("[BuildNo]", "tblVersion", "[VersionID] = 1"), ".00") & "
I have tried both Text and Integer as the Field types in the table. What am I doing wrong?