Link to home
Start Free TrialLog in
Avatar of David Lelièvre
David Lelièvre

asked on

Referring to a field in a form

I'm trying to create a query in which I'm referring to a text field in a form, but I'm getting an error:

Microsoft Access database engine does not recognize 'forms!Stats!txtFromDT' as a valid field name or expression

Why is this happening?

SELECT *
FROM tblEmployee
WHERE [Date] between forms!frmStats!txtFromDT and forms!frmStats!txtThruDT and [WorkerID] = forms!frmStats!lstWorkID;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David Lelièvre
David Lelièvre

ASKER

Right, the form wasn't open thanks! It was on the main form.
Sorry about this, but just a quick question related to this..

I've made a crosstab from the query and I'm getting the error:

Microsoft Access database engine does not recognize 'forms!Stats!lstSelect' as a valid field name or expression

Do I also have to the Parameters Dialog for this? (It's a multi selection listbox)

Thanks.
You can't point to a multi-select list box.

Jim.
Thanks!