I am creating the ability to Log all my Users Errors. Here is the code I am using:
However, when i get to the cnn.execute line I get an error stating "No Value given for one or more required parameters." But I keep strSQL into a watch window and they all come out.
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 & "Select " & lngErrCode & ", '" & strErrDesc & "', " & strUserLogin _
& ", #" & Date & "#, '" & DLookup("[VersionNum]", "tblVersion", "[VersionID] = 1") & _
Format(DLookup("[VersionMinNum]", "tblVersion", "[VersionID] = 1"), ".00") & "', '" & strSub & "'"
cnn.Execute strSQL, , adExecuteNoRecords
End Sub
However, when i get to the cnn.execute line I get an error stating "No Value given for one or more required parameters." But I keep strSQL into a watch window and they all come out.