Requery error message query won't run

B

Bill_De

My database at the present time has two forms. In both of these forms I need
to run a requery to update information.
In the first form I need to update the designated region assigned to an
individual state. I have a combo box that selects the data from a separate
table.
In the Form I have code set under “Procedure on Clickâ€. Under this event I
have the following code:

Private Sub Combo59_Click()
Set db = CurrentDb()
Set qdf = db.QueryDefs(“Update Region Queryâ€)
qdf.Execute dbFailOnError
Me.Combo59.Requery
End Sub.

The update query is: field: Region Table: tblContacts Update To:
[tblStates]![Region]
When I am in form view and select a State the requery code automatically
functions correctly and updates the Region in the tblContacts Table.

HERE IS THE PROBLEM
In my other form I need to update Room assignments to remove the room from
the combo box.
I have a combo box that allows me to select a room location from another
table. In the Combo box properties I entered code in the event “On Click†the
same as in the previous form with the appropriate changes for the query and
combo box:

Private Sub Combo22_Click()
Set db=CurrentDb()
Set qdf=db.queryDefs(“Reserve Room Queryâ€)
qdf.Execute dbFailOnError
Me.Combo22.Requery
End Sub

The update Query is: Field: Availability BuildID
Table: tblhousing tblhousing
Update to: No
Criteria:[Forms]![fmsContacts]![fmsRegistration]![Combo22]

When I go to form view and select a room I get the following error message:

Run-Time Error ‘3061’
Too Few Parameters. Expected 1.

I run the debug and get the following in the code:
Qdf.Execute dbFailOnError is highlighted in yellow

PLEASE ADVISE ON WHAT I AM DOING WRONG I HAVE NO IDEA

NOTE: With both forms open and shrunk down:
When I go to queries and select the “Update Region Query†I get the message
“You are about to run an update query…†When I click on Yes the message comes
up “You are about to update 3 record(s)†I click yes and the query runs and
indicates 3 records have been updated.
When I select the “Reserve Room Query†I get the message “You are about to
run an update query…†I click on Yes and the query runs and indicates 1
record has been updated. When I check the table tblhousing the Availability
check box is unchecked and when I open the form and select room assignment
the room that I had picked previous is no longer shown so the query is
running correctly on it’s own it just does not run using the code.

Please advise on how to correct this problem.

thanks
Bill_De
 

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