data from a form into a query

mel

New member
Local time
Today, 13:21
Joined
Aug 17, 2010
Messages
6
hi im a novice access user and have built a basic hotel database the problem i have is i have a form called

searchCustomersForm which has a field called CustomerRef

CustomerRef is from a table called customerTable

customerTable is linked to bookingTable

bookingTable is linked to roomNo

and i have built a query

SELECT bookingTable.ArrivalDate, roomNo.Rooms
FROM bookingTable, roomNo
WHERE (((customerTable.CustomerRef)= bookingTable.CustomerRef) And ((bookingTable.RoomRef)=roomNo.RoomRef));


when i enter a number in bookingTable.CustomerRef the query runs effectively when i test it

what i require is to somehow get the data from the CustomerRef field of the searchCustomersForm form into the query where bookingTable.CustomerRef is, is this possible and if it is how do i do it.

thank you for any help that you can give me.
 
Mel,

The simple answer to your question (thanks for the very clear explanation!) is that you can enter like this in the Criteria of the query:
[Forms]![searchCustomerForm]![CustomerRef]

However, I think your query is wrong. Create your query in Design View, and use Joins to link the tables, instead of the WHERE clause to try and relate the data.
 
thank you for your help sorry i took so long to reply i will test it when i get a chance and tell you if it worked thanks again for the help
 

Users who are viewing this thread

Back
Top Bottom