Others

Use NOT and AND to Exclude Multiple Criteria in an Access Query

Tauseeq MagsiTauseeq Magsi Nov 25, 2026 868 views

Question details

Exclude records only when State is Texas and Code is BKCL in a Microsoft Access query.

Exclude Multiple Criteria Using NOT and AND in an Access Query
Product
Microsoft Access
Device & OS
not provided
Scenario
A query should retain Texas records with other codes and non-Texas records with code BKCL.
Observed behavior
Using AND between two not-equal conditions excludes records that match either condition, removing more records than intended.
Before you start

Identify the table or query and confirm the names of its State and Code fields. Check whether either field can contain Null, because standard comparisons do not automatically retain every record with missing values.

Solution 1Recommended

Exclude the Texas and BKCL Combination in Access SQL

Use NOT around both conditions to exclude only records that match the specified combination.

1
Open SQL View

In Access, open the query in Design View, then select View > SQL View. To create a query, select Create > Query Design and switch to SQL View.

2
Enter the criteria

Use this query, replacing YourTableName with the actual table name: SELECT * FROM [YourTableName] WHERE NOT ([State] = "Texas" AND [Code] = "BKCL");

3
Run and check the query

Select Run and check that Texas/BKCL records are excluded while Texas records with other codes and non-Texas records with BKCL remain.

Exclude the Texas and BKCL Combination in Access SQL
Handling Null values: If records with a Null State or Code should also be retained, use WHERE [State] Is Null OR [Code] Is Null OR NOT ([State] = "Texas" AND [Code] = "BKCL").
Free Microsoft Office alternative

Review Exported Access Data in WPS Spreadsheets

WPS Office is a free, lightweight Office alternative with a familiar interface for working with exported data. Export an Access query to Excel, then open the workbook in WPS Spreadsheets for an easy transition to spreadsheet review. WPS does not run or fix Access queries.

Review exported query results with spreadsheet filtersOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar interface to work with Office documentsWork with a free, lightweight Office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does using AND between two not-equal conditions remove too many records?

WHERE [State] <> "Texas" AND [Code] <> "BKCL" requires both fields to differ from the specified values. It therefore excludes every Texas record and every BKCL record, rather than only the Texas/BKCL combination.

Can I use OR instead of NOT in the Access query?

Yes. For non-Null values, WHERE [State] <> "Texas" OR [Code] <> "BKCL" is equivalent to NOT ([State] = "Texas" AND [Code] = "BKCL").

How can I keep records with a missing State or Code?

In SQL View, add explicit Null checks: WHERE [State] Is Null OR [Code] Is Null OR NOT ([State] = "Texas" AND [Code] = "BKCL").

How do I review the Access query results in WPS?

In Access, export the query results to an Excel workbook using the External Data export options. Open the resulting XLSX file in WPS Spreadsheets; the Access query itself must still be created and run in Access.