Syntax - 424 Object Required Error on Line of Code

Viewed 35

I keep getting a 424: Object Reuqired error on the following line of code:

 If rstCurrent.Fields(1).Value Is Not Null Then
 MaxDate = rstCurrent.Fields(1)
 End If

Is the syntax for this an issue. Why would it pick up the line before it:

If rstCurrent.Fields.Count > 0 Then

End if

and give me the correct number of feilds for the table (8) but error out on the previous?

1 Answers

Use VBA syntax:

If Not IsNull(rstCurrent.Fields(1).Value) Then
    MaxDate = rstCurrent.Fields(1).Value
End If
Related