conflict of date of booking

D

Dqueen

Hi im a newbie in microsoft access. Im making a database About a Party
Booking. How can i Compare 3 fields and have a message if the date, time and
Party Room is already taken.
1.Date_of_Booking
2.Time_of_booking which has 3 options using a combo box
11:00am-2:00Pm
3:00am-6:00am
7:00am-10:00Pm
3.Party room which has 2 Rooms using a combo box
Party Room1
Party Room2

Your assistance would be greatly appreciated.
 
M

Marshall Barton

Dqueen said:
Hi im a newbie in microsoft access. Im making a database About a Party
Booking. How can i Compare 3 fields and have a message if the date, time and
Party Room is already taken.
1.Date_of_Booking
2.Time_of_booking which has 3 options using a combo box
11:00am-2:00Pm
3:00am-6:00am
7:00am-10:00Pm
3.Party room which has 2 Rooms using a combo box
Party Room1
Party Room2


Use a query with criteria under the appropriate field.

OTOH, maybe you are doing the check in a form procedure. If
so then an expression like this should do it:

If DCount("*", table, "datefield=" & _
Format(Me.datefield,"\#yyyy-m-d\#") _
& " AND timefield=""" & Me.timefield _
& """ AND roomfield=""" Me.roomfield & """") _
MsgBox "time/room already booked"
End If
 
D

Dqueen

Thanks For the Reply. Im still confuse. It did not work Im using a combo Box
for TimeofBooking And PatryRoom and a textbox For my Date_of_Booking. My
Table is Customers Information. how can i declare it and what is the right
syntax. Im Just new in Access and it been a decade since my last program.
Thanks again!
 
M

Marshall Barton

Maybe the easiest thing would be to create a unique index on
the three fields (in table design, use View Indexes). You
may not care for the message, but it will get you going a
lot sooner than learning about VBA event procedures.
 

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