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

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.