Solved

Query crireria

Posted on 2014-07-31
8
122 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

770 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