Solved

Query crireria

Posted on 2014-07-31
8
123 Views
Last Modified: 2014-07-31
I normally use this criteria to get a query to filter the records if there is a value in form field and ignore it if not plus any records in the query that have no values in the criteria field

Like nz([Forms]![Doors]![E],"*") Or Is Null

But now I need to say if there is a value in the form field I want all the records with values greater than the form field value plus any records in the query that have no values in the criteria field

Like nz(>=[Forms]![Doors]![E],"*") Or Is Null

But I cannot get it to work
0
Comment
Question by:DatabaseDek
  • 5
  • 3
8 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 40231301
Try this:

>=  nz([Forms]![Doors]![E], -999)


(-999 is some arbitrary value that is lower than any 'reasonable' value in your data)
0
 

Author Comment

by:DatabaseDek
ID: 40231325
The problem is the null values

I have just done this in a query grid field to return a zero if there is a null but it appears that the criteria runs before the selection below. So it will convert nulls to zeros but after the criteria has already eliminated the nulls.

A: IIf(Mid([AcousticRating],3,4)>0,Mid([AcousticRating],3,4),0)
0
 

Author Comment

by:DatabaseDek
ID: 40231329
Which means that my idea to make your solution work did not work.

So your idea is brilliant if I did not have nulls
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 61

Expert Comment

by:mbizup
ID: 40231342
Perhaps this:

>=  nz([Forms]![Doors]![E], -999)  OR IS NULL

If that doesn't help, post the SQL and some sample data.
0
 

Author Comment

by:DatabaseDek
ID: 40231372
The problem is the nulls. How do I get this greeter than criteria and also get the Nulls
0
 

Author Comment

by:DatabaseDek
ID: 40231392
This was the solution

>=nz([Forms]![Doors]![K],"*") Or Is Null Or nz([Forms]![Doors]![K],"*")

I have no idea how it works but it does so!
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 40231400
That last nz looks redundant.

Try this:

>=nz([Forms]![Doors]![K],"*") Or Is Null

The issue with the syntax in your original post is that the >= needed to be *outside* of the NZ.

Regarding the "*" versus -999, are you dealing with TEXT fields rather than numeric fields?  If so the "*" behaves similarly to the -999 (which would work for numeric fields).  It is simply an arbitrary low value, which alphabetically comes before any expected values in your data.
0
 

Author Closing Comment

by:DatabaseDek
ID: 40231671
Wicked!!

Thank you

Derek
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question