Access Query Criteria "Not" not working?

Maggie Barr

Board Regular
Joined
Jan 28, 2014
Messages
188
Hello, and thank you in advance if you can help.
I have a query where I created a column "Outside_Safe_Dates" where if an observation date is outside a safe date range it puts "Outside". That is working fine, but now I want to filter out those that are "Outside", so in that column, under criteria, I put Not "Outside" and it returned an empty data set. When I went back to the design, it had changed it to <> "Outside". I tried other variations like using parentheses, and it always returns the blank data. I then thought perhaps I couldn't run it within the same query that the column was created in, so I made a query of the query and the same thing happens. Does anyone have an idea on why this may be happening? I think it could be that it isn't a physical table that is the base of my query, but I am new to access, so I am not sure. I have a large dataset, so I want to minimize the number of physical tables I need to load. To do much more, I would have to create another database to develop it much further, and I would like to avoid that if I can.
Thank you for your time,
Maggie
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
ranman256,
Thank you for your reply, but I am not sure I understand what you mean. I created a column with:
Outside_safe_Dates: IIf([DAY-MONTH_VALUE]<[START_Date_VALUE],"Outside",IIf([DAY-MONTH_VALUE]>[END_Date_VALUE],"Outside"))

This gives me a column with blanks for what would be "Inside" and "Outside" for records that fall outside the safe date range. Are you saying that I should modify the expression to list "Inside" Or "outside, thus no blanks? If so, do you know how I would modify the expression, or am I getting what you are saying all wrong?
Thanks,
Maggie
 
Upvote 0
ranman256,
I got it! Sorry not to have caught on before my response. I modified the expression to: Outside_safe_Dates2: IIf([DAY-MONTH_VALUE]<[START_Date_VALUE],"Outside",IIf([DAY-MONTH_VALUE]>[END_Date_VALUE],"Outside","Inside"))

I then ran the criteria Not "Outside" and it works. Funny that when I go back into design view it has changed it to <>"Outside" vs the Not that I put, but it is working.
Thanks for your help!
Best Wishes,
Maggie
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,344
Members
452,638
Latest member
Oluwabukunmi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top