Too Few Parameters

G

Guest

Thanks for taking the time to read my question.

I get the error "Too Few Parameters" when I run my query. In my query I
have 2 fields that have criteria on them. I have parameters for these two
fields. I am guessing that the second parameter is causing the problem as it
references 2 different fields.

How do I get around this?

Thanks,

Brad


Code:

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblBooking")
Set qdf = dbs.QueryDefs("qryAddNewBookingPossible")
qdf.Parameters(0).Value =
[Forms]![frmtblBookingAddNew]![BookingRoomBooked]
qdf.Parameters(1).Value = "Between " &
[Forms]![frmtblBookingAddNew]![BookingStartDate] & " And " &
[Forms]![frmtblBookingAddNew]![BookingEndDate] 'Problem Here
 
D

Duane Hookom

You are defining two parameters when you have 3 controls on forms referenced
by your querydef. Your start date and end date are each parameters.
 
G

Guest

Ah, so parameter doesn't equal a criteria statement.

Got it. Thanks Duane.

Have a great week.

Brad

Duane Hookom said:
You are defining two parameters when you have 3 controls on forms referenced
by your querydef. Your start date and end date are each parameters.

--
Duane Hookom
MS Access MVP
--

Brad said:
Thanks for taking the time to read my question.

I get the error "Too Few Parameters" when I run my query. In my query I
have 2 fields that have criteria on them. I have parameters for these two
fields. I am guessing that the second parameter is causing the problem as
it
references 2 different fields.

How do I get around this?

Thanks,

Brad


Code:

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblBooking")
Set qdf = dbs.QueryDefs("qryAddNewBookingPossible")
qdf.Parameters(0).Value =
[Forms]![frmtblBookingAddNew]![BookingRoomBooked]
qdf.Parameters(1).Value = "Between " &
[Forms]![frmtblBookingAddNew]![BookingStartDate] & " And " &
[Forms]![frmtblBookingAddNew]![BookingEndDate] 'Problem Here
 

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