Can anyone tell me what I am doing wrong in the following code?
I get this error when I try to run the following code:
Compile error:
Expected Function or variable

and the Execute method is hilighted (shown here in blue). I used the method browser to select the Execute method, so it shouldn't be mis-spelled.

Code:
Private Sub Form_BeforeInsert(Cancel As Integer)
    Dim db1 As Database
    Dim rs As Recordset

    Set db1 = CurrentDb
    
    Set rs = db1.Execute("ListItemQuery")
    MsgBox "database: " & db.Name & vbCrLf & "  max item number: " & rs.maxoforderid
End Sub