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

Microsoft AccessSQL

Avatar of undefined
Last Comment
David Lelièvre

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Jim Dettman (EE MVE)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
David Lelièvre

ASKER
Right, the form wasn't open thanks! It was on the main form.
David Lelièvre

ASKER
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.
Jim Dettman (EE MVE)

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

Jim.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
David Lelièvre

ASKER
Thanks!