View Single Post
  #2  
Old February 16th, 2007, 12:38 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default query issues - critera being ignored

The criteria are not being ignored. You've basically told the query to get
all records that have a value in the USER field and have a status other than
"Complete" with the second line. That includes those in the first line of
criteria

What do you expect to see? Do you want a copy of the record to appear it
the first set of criteria and another copy of the record to appear if it
meets the second set of criteria?

Example,
Get me all males in the room and get me John Spencer (a male). So, do you
expect two copies of John Spencer to be presented to you.

IF you really need a copy of the record for each set of criteria, then you
need to look at using a UNION ALL query. Union queries cannot be built
using the query grid, but must be composed in SQL view.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"Dave" wrote in message
...
All,

Found some similar posts, but didn't help my sitaution. Any help would be
appreciated. I've got the following in query design view. The function
works and pulls in a variable from combo box. The appropriate records are
selected. What is killing me is if I add an "or" conditon. Either of the
conditions work seperately but when both exist in the query, all users
dispalyed is the outcome regardless if the variable is null or has value.
Trying to avoid wrtiing multiple queries for a form. Any thoughts? Thanks
in
advance.

(WORKS)

STATUS USER
---------- --------
"COMPLETE" GetUSER("A")

(WORKS)

STATUS USER
---------- --------
"COMPLETE" Like "*" (or use a blank)


(DOES NOT WORK DISPLAYS ALL, ignores GetUSER)
---------- --------
"COMPLETE" GetUSER("A")
"COMPLETE" Like "*"