Including a record thats inside an excluded range

rinova

Registered User.
Local time
Today, 11:08
Joined
Aug 27, 2012
Messages
74
Hi Access Experts,

Need help including a record that's inside an excluded range.

I have a table with record numbers from 1 to 91599. I want to exclude records from 91011 to 91599 but I don't want to exclude record 91102.

How do exclude a record that is included in the excluded range?

I could write two queries the first will excludes 91011 to 91101 and the second excludes 91103 to 91599. Is this the only way?

Thank you,

Rich
 
I would use 3 criteria lines:

<91011
>91599
91102

The real issue is, how come you want to exclude them based on that field? That's not real criteria--record number is essentially meta-data. It's not like you are using logic (exclude all red cars, exclude all females, etc.).
 
The table stores employer demographics (Name, Address, City, State, Zip, Zip4) but for some reason someone decided to create non-existing (fake) employers in this table with record numbers in to 90000 range. The problem is they added a existing (real) employer, and for some reason assigned it a record number in the 90000 range. After speaking to the person who works with this data for 5 minutes, I found out why this was done. I can explain it in more detail if you want.

Here is the current code I'm using:
Code:
SELECT DISTINCT dbo_employer.mis_number, dbo_employer.emp_owner_name, dbo_employer.mis_description, dbo_employer.mis_addr_1, dbo_employer.mis_addr_2, dbo_employer.mis_city, dbo_employer.mis_state, dbo_employer.mis_zip_code, dbo_employer.emp_zip_ext
FROM dbo_employer
WHERE (((dbo_employer.mis_number) Not Between 91011 And 91099) AND ((dbo_employer.emp_terminate_date) Is Null))
ORDER BY dbo_employer.mis_number;

As you can tell I'm excluding from the dbo_employer.mis_number

The results of the query will be used to create letters.

Thanks again,

Rich
 
Last edited:
There's got to be a better way to flag fake data than remembering the ID numbers. Why not create a new field (TestDate -> Yes/No)? Or you probably have a notes field you could do that in. What happens when they add new fake data and you aren't given the numbers? Better to have a way to discern fake data than to just know which ones are.

As for your code, don't exclude, include. See my previous post for that method.
 

Users who are viewing this thread

Back
Top Bottom