Setting Query Criteria In Access 2010 Through Logical Operators

As the name implies, Query pulls out specific data from table fields included in database, thus, setting specific criterion in query helps you to filter down the table field data according to your needs. Through simple logical operators in Query Criteria you can set a criteria by using simple AND/OR operators, which lets you to confine the results of a query based upon the query criteria to check which table field data is to be included.

To begin with, launch Access 2010 and open the database on which you need to set criteria for table fields. For illustration, we have created a database record of employees salary in table fields; Employee_ID, Year Of Service and Salary.

employeesalaries Setting Query Criteria In Access 2010 Through Logical OperatorsView in gallery

We will start off with creating a query, navigate to Create tab and click Query Design.

querydesign Setting Query Criteria In Access 2010 Through Logical OperatorsView in gallery

Show Table dialog will appear, select the table you want to include and click Add. Once table is added, click Close.

Query 1View in gallery

Now double-click table fields which you want to include in Query Design fields.

add fieldView in gallery

Here we want to pull a specific record from the table, i.e, details of employees having salary ranges from 4000 to 6000. For this condition, we will be using AND logical operator and write the criteria as;

> 4000 And <6000

andView in gallery

Now under Query Tools, switch to Design tab and click Run to execute the query.

RunView in gallery

It will pull out results that match with the applied criteria.

query salaryView in gallery

Now we would like to view employees according to Year of Service criteria, i.e,  more than 2 years And less than 6 of service. For applying this condition, under Design Query window, we will write this condition under Year of Service field as;

>3 And <6

year of serviceView in gallery

On executing Query, it will show employees details who rendered their services for more than 3 & less than 6 years.

employees between 3View in gallery

For inserting an OR condition, just enter number of Year in OR field. For instance we also want to show employees who worked for 2 years. For this, we will simply add 2 in OR field.

2View in gallery

On Query execution, it will show all the employees who have worked for more than 2 years and less than 6.

Query executioonView in gallery

You can also check out our previously reviewed guides on How to assign Password Data Type To a Specific Field In Access 2010 & How to Create Calculated Fields In Access 2010.

  • Inell Ricks

    how can I combine total working hours query with employees that has overtime hours, when there are less employees than there are employees that are actually, I have 600 employees working overtime on different pay combine, I have to combine all of the employees in the job that worked overtime and regular working hours and divided the percentage. I hope you can understand this, I know this is a lot