Sometimes my users get the followign error:
error 94
Invalid use of null
But problem is there are just some users who got this error
I am using :
Public Function RNull(sIn As Variant) As String
If IsNull(sIn) Then
RNull = ""
Else
RNull = sIn
End If
End Function
to avoid the error.
The code is:
=================================================
Private Sub InsertNewIllustrationNumberRoyalty()
On Error GoTo ERRORHANDLER
Dim sSQL As String
Dim lRecordsAffected As Long
Screen.MousePointer = vbHourglass
lRecordsAffected = clsDB.Insert(RNull(txt.illustrationID.text))
If lRecordsAffected <> 1 Then
MsgBox "There was an error."
bError = True
End If
Set rs = New ADODB.Recordset
sSQL = "SELECT @@IDENTITY " & vbCrLf
rs.Open sSQL, CnDB, adOpenForwardOnly, adLockReadOnly
If Not rs.EOF Then
glCardArtID = CLng(rs.Fields(0).Value)
Else
bError = True
End If
If glCardArtID = 0 Then
bError = True
End If
rs.Close
Screen.MousePointer = vbNormal
Exit Sub
ERRORHANDLER:
bError = True
goErr.ErrorType = iTYPE_FATAL
goErr.Source = "InsertNewIllustrationNumberRoyalty"
goErr.OriginalError = Err.Number
goErr.Msg = Err.Description
goErr.Additional = "Line: " & Erl
goErr.Title = sEmpty
goErr.SQL = sEmpty
goErr.DisplayError
Screen.MousePointer = vbNormal
End Sub
===================================================
Please help...
error 94
Invalid use of null
But problem is there are just some users who got this error
I am using :
Public Function RNull(sIn As Variant) As String
If IsNull(sIn) Then
RNull = ""
Else
RNull = sIn
End If
End Function
to avoid the error.
The code is:
=================================================
Private Sub InsertNewIllustrationNumberRoyalty()
On Error GoTo ERRORHANDLER
Dim sSQL As String
Dim lRecordsAffected As Long
Screen.MousePointer = vbHourglass
lRecordsAffected = clsDB.Insert(RNull(txt.illustrationID.text))
If lRecordsAffected <> 1 Then
MsgBox "There was an error."
bError = True
End If
Set rs = New ADODB.Recordset
sSQL = "SELECT @@IDENTITY " & vbCrLf
rs.Open sSQL, CnDB, adOpenForwardOnly, adLockReadOnly
If Not rs.EOF Then
glCardArtID = CLng(rs.Fields(0).Value)
Else
bError = True
End If
If glCardArtID = 0 Then
bError = True
End If
rs.Close
Screen.MousePointer = vbNormal
Exit Sub
ERRORHANDLER:
bError = True
goErr.ErrorType = iTYPE_FATAL
goErr.Source = "InsertNewIllustrationNumberRoyalty"
goErr.OriginalError = Err.Number
goErr.Msg = Err.Description
goErr.Additional = "Line: " & Erl
goErr.Title = sEmpty
goErr.SQL = sEmpty
goErr.DisplayError
Screen.MousePointer = vbNormal
End Sub
===================================================
Please help...