Query Criteria to Show Unmatched If Date RANGE is Null

RMS123

Board Regular
Joined
Jun 1, 2016
Messages
62
Hi there,

I am pretty new with Access and don't know how to go about this.

I am trying to show unmatched entries (from 2 Queries) if it is not within a date before or after the entry based in the other AND if trace number doesn't match. I hope that all makes sense....

Here is what I have for SQL code, hope someone could help me out :).

Code:
SELECT [Posted Not Remitted].TRACE, [Posted Not Remitted].ACCOUNT, [Posted Not Remitted].CARD, [Posted Not Remitted].AMOUNT, [Posted Not Remitted].Date, [Posted Not Remitted].Error
FROM [Posted Not Remitted] LEFT JOIN [Remitted Not Posted] ON ([Posted Not Remitted].Date = [Remitted Not Posted].Date) AND ([Posted Not Remitted].[TRACE] = [Remitted Not Posted].[TRACE])
WHERE ((([Remitted Not Posted]![Date]-1) Is Null) AND (([Remitted Not Posted]![Date]+1) Is Null) AND (([Remitted Not Posted].Date) Is Null) AND (([Remitted Not Posted].TRACE) Is Null));
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Why are you using a bang operator (!) here:
[Remitted Not Posted]![Date]

Is this in a form?

Otherwise, since you have Date = Date in the On clause you will only get matches on exact dates, not ranges of dates, and I don't see how the use of Null checks is helping to create a range either. If you put equals in the ON clause than that's going to override whatever you do in the WHERE clause.

For a range of dates you need something like:
where [Date] > X and [Date] < Y

or:
where [Date] between (X and Y)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,814
Messages
6,162,132
Members
451,743
Latest member
matt3388

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