Run-time error Object Required

K

Katie

I have the following code attached to a form button and
get run-time error Object Required. What is the problem?
Is the record I get in executing the query not available
in this macro? How do I get around this? Thanks.

Private Sub Command14_Click()

DoCmd.OpenQuery "QueryAv"

If AVAILABILITY.[Booking ID] = 1 Then
'Hide availability form
Forms![SINGLE BOOKING AVAILABILITY].Visible = False
'Open the detail form
DoCmd.OpenForm "SINGLE BOOKING DETAIL"
End If

Exit_Command14_Click:
Exit Sub

End Sub
 
R

RI

try putting the ! in before bookingid --- use
forms!AVAILABILITY![Booking ID]

you also may need a DIM and Set statement for the
openquery>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top