trishcollins
Registered User.
- Local time
- Today, 12:33
- Joined
- Mar 23, 2011
- Messages
- 42
I have a table of data I run a query on. The table has a location code and a account code. A location code can have one or multiple account code records.
I am trying to write a query that does the following:
Filters ONLY on location with one specific account code + at least one other account code of my choosing. I have created a table which is a subset of the Account Codes I want to see in the report.
In the example below, the location must at least have the account code "NPSN" in addition to at least one or more of the other account codes in the account code table. The bold is the base account code. If there is no "NPSN" account code, I don't want to see ANY of the other account code records for that location.
Location ID Account Code
123456 NPSN
123456 Radio
123456 PTSS
In the query, I perform the following to limit the account codes:
=DLookUp("[Account_Code]","NSB Dynadocs NetCon Account Codes","[Account_Code] = '" & [Account Code] & "'")
That at least limits the account codes to only those I want in the report (there are many more I don't want to see). But have yet to figure out how to limit the list so that locations on the report must all have the NPSN account code and one other account code before being included.
I have a feeling this might be something to do with counting records for each location, and then seeing if there is more than one account code and at least one of the account codes is NSPN, but I am not able to figure out the syntax. Any suggestions?
I am trying to write a query that does the following:
Filters ONLY on location with one specific account code + at least one other account code of my choosing. I have created a table which is a subset of the Account Codes I want to see in the report.
In the example below, the location must at least have the account code "NPSN" in addition to at least one or more of the other account codes in the account code table. The bold is the base account code. If there is no "NPSN" account code, I don't want to see ANY of the other account code records for that location.
Location ID Account Code
123456 NPSN
123456 Radio
123456 PTSS
In the query, I perform the following to limit the account codes:
=DLookUp("[Account_Code]","NSB Dynadocs NetCon Account Codes","[Account_Code] = '" & [Account Code] & "'")
That at least limits the account codes to only those I want in the report (there are many more I don't want to see). But have yet to figure out how to limit the list so that locations on the report must all have the NPSN account code and one other account code before being included.
I have a feeling this might be something to do with counting records for each location, and then seeing if there is more than one account code and at least one of the account codes is NSPN, but I am not able to figure out the syntax. Any suggestions?