DazedandMuddled
is not hard? is it......?
- Local time
- Today, 14:21
- Joined
- Apr 9, 2004
- Messages
- 11
Too few parameters?!?
Can anyone check this code and tell me where i've gone wrong....please!
VBA code is:
code:---------------------------------------------------------------------
Private Sub ConfirmBooking_Click()
Dim DB As DAO.Database
Dim rst As DAO.Recordset
Set DB = CurrentDb()
Set rst = DB.OpenRecordset("qryBooking")
If rst.BOF And rst.EOF Then
Call MsgBox("Your booking is confirmed", vbExclamation, "Booking Confirmed")
DoCmd.GoToRecord , , acNewRec
Else
rst.MoveFirst
Do Until rst.EOF
If rst.RecordCount > 0 Then
Call MsgBox("Sorry this aircraft is already booked, please choose another time", vbCritical, "Error")
End If
rst.MoveNext
Loop
End If
End Sub
-------------------------------------------------------------------------
and the SQL query code is:
code:---------------------------------------------------------------------
SELECT BookingDetails.AcReg, BookingDetails.HireDate, BookingDetails.StartTime, BookingDetails.EndTime,
FROM BookingDetails
WHERE (((BookingDetails.AcReg)=Forms!BookingForm!cboAcReg)
And
((BookingDetails.HireDate)=Forms!BookingForm!cboHireDate)
And
((BookingDetails.StartTime) Between forms!bookingform!cboStarttime And Forms!BookingForm!cboEndTime)
Or (((BookingDetails.AcReg)=Forms!BookingForm!cboAcReg)
And ((BookingDetails.HireDate)=Forms!BookingForm!cboHireDate)
And ((BookingDetails.EndTime) Between forms!bookingform!cboStarttime And Forms!BookingForm!cboEndTime) ;
--------------------------------------------------------------------------
the error message i get is runtime error 3061, too few parameters: expected 4
i can't figure out why
this code runs from a button on my form which contains all the above fields as combo boxes!
Any pointers anyone?
TIA
Cam
Can anyone check this code and tell me where i've gone wrong....please!
VBA code is:
code:---------------------------------------------------------------------
Private Sub ConfirmBooking_Click()
Dim DB As DAO.Database
Dim rst As DAO.Recordset
Set DB = CurrentDb()
Set rst = DB.OpenRecordset("qryBooking")
If rst.BOF And rst.EOF Then
Call MsgBox("Your booking is confirmed", vbExclamation, "Booking Confirmed")
DoCmd.GoToRecord , , acNewRec
Else
rst.MoveFirst
Do Until rst.EOF
If rst.RecordCount > 0 Then
Call MsgBox("Sorry this aircraft is already booked, please choose another time", vbCritical, "Error")
End If
rst.MoveNext
Loop
End If
End Sub
-------------------------------------------------------------------------
and the SQL query code is:
code:---------------------------------------------------------------------
SELECT BookingDetails.AcReg, BookingDetails.HireDate, BookingDetails.StartTime, BookingDetails.EndTime,
FROM BookingDetails
WHERE (((BookingDetails.AcReg)=Forms!BookingForm!cboAcReg)
And
((BookingDetails.HireDate)=Forms!BookingForm!cboHireDate)
And
((BookingDetails.StartTime) Between forms!bookingform!cboStarttime And Forms!BookingForm!cboEndTime)
Or (((BookingDetails.AcReg)=Forms!BookingForm!cboAcReg)
And ((BookingDetails.HireDate)=Forms!BookingForm!cboHireDate)
And ((BookingDetails.EndTime) Between forms!bookingform!cboStarttime And Forms!BookingForm!cboEndTime) ;
--------------------------------------------------------------------------
the error message i get is runtime error 3061, too few parameters: expected 4
i can't figure out why
this code runs from a button on my form which contains all the above fields as combo boxes!
Any pointers anyone?
TIA
Cam