Solved

Query crireria

Posted on 2014-07-31
8
120 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now