06-18-04, 13:06 #1Registered User
- Join Date
- Jun 2004
Unanswered: Need help with syntax errors, can anyone help???
Ihave tryed many different ways to get this to work biyt am still getting sytax errors.
Can any find the problem or come up wiyj an alternitive?
Private Sub addrecord_Click()
On Error GoTo Err_addrecord_Click
If Dcount ("[Reservation Date] = " & ReservationDate & " AND "[Asset ID] = " & AssetID & " AND " & TimeBookedIn & " BETWEEN [Time Booked Out] AND [Time Booked In] OR " & TimeBookedOut & " BETWEEN [Time Booked Out] AND [Time Booked In])") > 0 Then
'MsgBox "Dulpicte Record, change asset ID or booking time"
DoCmd.GoToRecord , , acNewRec
I want to prevent any double booking can any on help
I am a beginner in access so go easy on me
Customer 1 wants an asset from:
Time Booked Out14:00
Time Booked In16:00
Customer 2 wants to book the same asset from:
Time Booked Out 15:00
Time Booked In 17:00
The tables I have:
Service Record ID
Customer First Name
Customer Last Name
06-18-04, 13:36 #2Cavalier King Charles
- Join Date
- Dec 2002
- Préverenges, Switzerland
if [Reservation Date] is a date, you need:
If Dcount ("[Reservation Date] = #" & ReservationDate & "# AND...
probably similarly for Time (but i dont use times so it's a guess)
last thought, add some (many) parenthesis:
((this AND that) or theother) <> (this AND (that OR theother))
without parenthesis to force A to think your way - murphy's law dictates that A will ALWAYS make the wrong guess.
and finally i notice your abuse of DCOUNT() ...it is ghastly, sorry. think of it like
DCOUNT("fieldInQuotes", "tableOrQueryInQuotes", "criteriaInQuotes")
and you wont be suprised that yours doesn't work.
Last edited by izyrider; 06-18-04 at 13:39.currently using SS 2008R2