Query not using fields on form instead asking for parameters to be entered

iainmid

Registered User.
Local time
Today, 06:37
Joined
Mar 1, 2007
Messages
35
I have created a query that will pull the price of a property into the cost field combo box on a booking order subform depending on the values of the start date and property number enter onto the same form.

The query gets the price from the property price table matching on the property no i've selected on the booking order subform and also the start date i've entered on the booking order subform which needs to be between the start and end date fields in the property price table.

Fields in the property price are property price no, property no, start date, end date and price.

Also the booking order subform is a subform on a booking form

This is the query i have created:
SELECT [Property Price].Price
FROM [Property Price]
WHERE (((forms![booking order subform]![start date]) Between [property price].[start date] And [property price].[end date]) And (([Property Price].[Property No])=forms![booking order subform]![property no]));

The problem is when i run the query from the cost combo box the query isn't picking up the fields on the booking order subform instead its bring up a seperate meesage box from parameters start date and property number to be enter.
Can someone give me advise how to make the query use the values in the fields on the booking order subform i enter before running the query. cheers
 
In query criteria put;
[Forms]![MainFormName]![SubFormname]![FieldName]
 
MStef addressed the specific issue.

The general issue is that Access looks at queries to determine the source of each field. If it cannot identify the source, it treats it like a parameter and asks for a value.

Therefore, when you get such a question, your best guess is that the query contains a field reference that is either spelled wrongly or incompletely qualified. (MStef's answer represents the latter case.)
 

Users who are viewing this thread

Back
Top Bottom