Query Criteria Help

S

Shell

In Access 2000, I am trying to create a query with a strange criteria

I have a field in a form (frmReportingTool) named txtX.
I also have a field in the table named X.
When I have a value in txtX, the query works just fine. But in the case
where txtX ="", then I need the query to get ALL the data records not caring
about X. All values of X are needed.

IIf([X]="","",[forms]![frmReportingTool]![txtX])

What am I missing?

Thanks
 
D

Dale_Fye via AccessMonster.com

would help if you posted the query.

Assuming that txtX is an unbound textbox, what you need is something like:

SELECT * FROM yourTable
WHERE [X] = Forms!frmReportingTool.TxtX
OR Len(forms!frmReportingTool.TxtX & "") = 0

HTH
Dale
In Access 2000, I am trying to create a query with a strange criteria

I have a field in a form (frmReportingTool) named txtX.
I also have a field in the table named X.
When I have a value in txtX, the query works just fine. But in the case
where txtX ="", then I need the query to get ALL the data records not caring
about X. All values of X are needed.

IIf([X]="","",[forms]![frmReportingTool]![txtX])

What am I missing?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top