Start New Discussion within our Software Development Community

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
    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
        If b = False Then
            Combo1.AddItem ep
        End If
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
    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]
'[your code]
end if
This article has been dead for over six months. Start a new discussion instead.