I finally got the query to accept as you have (think I missed off the final bracket). I have now got it to work in my database but this is beyond strange. I get a valid result for an invalid change?????
Your Code works perfectly on the small database but is not validating correctly in my database.
I am using your code as excact and am not getting any error but it is not validating like your example.
Code used is
The call to DCount is
Just in case it is a table problem I will empty my table and use my add booking proedure to create 3 bookings and then try to change, lets see what happens
Your Code works perfectly on the small database but is not validating correctly in my database.
I am using your code as excact and am not getting any error but it is not validating like your example.
Code used is
Code:
strSQL = "[BookStartDate] = " & Format(dteDate, "\#mm\/dd\/yyyy\#") & " AND " & _
"[BookLocation] = '" & strRoomNo & "' AND " & _
"([BookTime] BETWEEN '" & Format(DateAdd("n", 1, dteStartTime), "Medium Time") & "' AND " & _
"'" & Format(DateAdd("n", -1, dteEndTime), "Medium Time") & "' OR " & _
"[BookEndTime] BETWEEN '" & Format(DateAdd("n", 1, dteStartTime), "Medium Time") & "' AND " & _
"'" & Format(DateAdd("n", -1, dteEndTime), "Medium Time") & "')" & _
IIf(Me.NewRecord, vbNullString, " AND " & "[BookID] <> " & BookRef)
The call to DCount is
Code:
Valid = (DCount("*", "qryEditBookings", strSQL))