Put message to form

B

Brian C

I have a form to query availability and I can run the
following SQL to get records:

SELECT AVAILABILITY.BookingDate, AVAILABILITY.Period,
AVAILABILITY.Room, AVAILABILITY.[Booking ID]
FROM AVAILABILITY
WHERE (((AVAILABILITY.BookingDate)=forms![SINGLE BOOKING
AVAILABILITY]![BookingDate]) AND ((AVAILABILITY.Period)
=forms![SINGLE BOOKING AVAILABILITY]![Combo8]) AND
((AVAILABILITY.Room)="*"));

How do I then process each record in turn to check the
Booking ID field for a value of 1 and if any record
returned contains 1 put a message on my form [SINGLE
BOOKING AVAILABILITY] to say select another room. If none
contains 1 then I want to put a message on my form to say
select another date or period?

I then need to set the focus on either the room room or
date input boxes

Where is the best place to put such a message on the form?

Thanks in advance
 
M

Michel Walsh

Hi,

The exact syntax, I can't tell from the supplied information, but the basic
idea is to check if the count return 0 or not:


SELECT 0=COUNT(*)
FROM ???
WHERE Booking=1


Hoping it may help,
Vanderghast, Access MVP
 

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

Similar Threads

syntax error? Help 2
Process records from a query 1
Help me ! 4
Help with queries 0
DoCmd.RunSQL error Help 5
Checking values in returned records 0
Process multiple records 1
Getting data from forms 2

Top