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"
Else
DoCmd.GoToRecord , , acNewRec


End If




Exit_addrecord_Click:
Exit Sub

Err_addrecord_Click:
MsgBox Err.Description
Resume Exit_addrecord_Click

End Sub



I want to prevent any double booking can any on help

I am a beginner in access so go easy on me ļ

For example:

Customer 1 wants an asset from:
Date: 11/11/04
Time Booked Out14:00
Time Booked In16:00

Customer 2 wants to book the same asset from:
Date: 11/11/04
Time Booked Out 15:00
Time Booked In 17:00

The tables I have:

Reservations
Reservation ID
Reservation Date
Asset ID
Booked Out
Booked In
Customer ID


Asset
Asset ID
Asset Description
Asset Photo

Service Records
Service Record ID
Asset ID
Description
Problem Date
Resolved Date

Customers
Customer ID
Customer First Name
Customer Last Name

Assets
Asset ID
Time Collected
Time Returned