1.11M Members

Run time error '94' Invalid use of Null

 
0
 

Hello there need your expertise i got the run time error invalid use of null in line number 19. Thanks in advance

Private Sub Form_Load()
Dim oRS As New classRecordset

Set rsLibrary = oRS.CurrentRS(Books)

Set rsTrans = oRS.CurrentRS(Reserved)

With rsLibrary
    Combo1.Clear
    
    Dim i As Integer
    Dim st As String
    Dim b As Boolean
    
    
    Combo1.AddItem "All"
    
    Do While Not .EOF
        st = .Fields!Category
        b = False
    
    For i = 0 To Combo1.ListCount
        If st = Combo1.List(i) Then
            b = True
            
            Exit For
        End If
    Next
    
        If b = False Then
            Combo1.AddItem ep
        End If
        .MoveNext
        
    Loop
End With

lv.ColumnHeaders.Item(1).Width = lv.Width * 0.75
lv.ColumnHeaders.Item(2).Width = lv.Width * 0.25

If Combo1.ListCount > 0 Then

    Combo1.ListIndex = 0
Else
    Combo1.ListIndex = -1
End If
End Sub
 
0
 

Most of that problem occured is when you try to retieved a data from the database.
Check if the field has the null data or not.

if not isnull(.Fields!Category) then
'[your code]
else
'[your code]
end if
You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article