Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem when using 1QBF field as criteria for more than 1 query field

Status
Not open for further replies.

Manny64

Technical User
May 1, 2001
16
0
0
CA
Hi all,
I need help in figuring out a way of resolving this problem...

I have a Query-By-Form:
Forms!qbfComplaints

...with multiple unbound fields:
[qbf1]
[qbf2]
[qbf3]

My query has the following fields and criteria:

Field:
[ComplaintID]
Criteria:
[Forms]![qbfComplaints]![qbf1] or [Forms]![qbfComplaints]![qbf1] Is Null

Field:
[Status]
Criteria:
[Forms]![qbfComplaints]![qbf2] or [Forms]![qbfComplaints]![qbf2] Is Null

Field:
[Badge1]
Criteria:
[Forms]![qbfComplaints]![qbf3] or [Forms]![qbfComplaints]![qbf3] Is Null

Field:
[Badge2]
Criteria:
[Forms]![qbfComplaints]![qbf3] or [Forms]![qbfComplaints]![qbf3] Is Null

Field:
[Badge3]
Criteria:
[Forms]![qbfComplaints]![qbf3] or [Forms]![qbfComplaints]![qbf3] Is Null

You will notice that the criteria for my Query Fields: Badge1, Badge2 and Badge3 are exactly the same.

When I run this query I get zero returns. Although when I tried testing the qbf by removing the Query Fields: Badge2 and Badge3 I got the proper results.

In essence what I wish to do is...by using one QBF field I want to query three different fields using the same criteria.

I would appreciate any assistance in this matter.

Thanks in advance,
Manny
 
The fact that removing criteria for [Badge2] and [Badge3] made the query work leads me to think that when those criteria were included they were on the same line as the [Badge1] criteria. That would cause them to be treated as AND conditions. Therefore only when [Badge1], [Badge2] and [Badge3] matched would you get a result. That is probably not likely.

In the query designer put each badge criteria on a different line. You'll also need to repeat the other criteria on each line.

Or in SQL do the following:

Select * From table1
Where [complaintid]=...
and [Status]=...
and ([Badge1=...
Or [Badge2]=...
Or [Badge3]=...)

I hope all this makes sense.
Terry
 
You are a genius! I works.

Thank you very much!

Manny64
 
I meant IT WORKS (not "I works.")

Manny64
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top