View Full Version : Referencing form fields in Queries


haywardi
05-26-2011, 12:40 AM
Hi,

I've just upscaled my Access 2010 project to use SQL server as the backend and I'm experiencing a few problems with my code. Most have just been syntax, however I can't find away around the problem described below so any help would be appreciated.

On my form I have a list box. The list box is controlled by a query that takes the customer id from a field on the form.

Before I upscaled the query had the following criteria:

= forms!customers.form![customer id]

Everything worked.

After upscaling the criteria on my query was changed to

=@form_customers_form__customer1

And it doesn't work.

If I try the original query ACCESS complains that the data type is wrong.

if I try changing the criteria to

=@form_customer_form__[customer id]

It complains.

It can only by syntax (surely) but I don;t know the correct syntax to get the query to use the correct field.

All help appreciated.

Iain