Many of united state use Microsoft accessibility to extract data from Banner or other enterprise systems, or to keep data the doesn’t fit in our enterprise system. This reminder provides an overview of the criteria ar in access queries, consisting of Flexible Criteria, date Criteria, and also Using Tables together Input.

You are watching: How to set criteria in access to begin with a letter

(Note: If you shot to copy the criteria fields shown below directly to Access, you may gain an extra collection of quotation marks that will should be deleted. Microsoft indigenous quotation marks carry out not always work in Access.)As one example, check out the following access query the pulls straightforward course data from a data warehouse produced from Banner.

Figure 1

When to run this query you would get something that looks favor this:
As the stands, the query traction every course readily available for the past several years (almost 9,000 records). This can be valuable for some purposes, but, generally, you most likely want to pick a certain group of process to deal with a details question. This is wherein the criteria ar comes in handy.Let’s to speak you are just interested in Physics great or lab sections that accomplish on Monday and/or Wednesday for calendar year 2013-14. You can modify the query using the adhering to criteria to obtain this result.

Figure 3

Under the Subj_code field, include the criteria “PHYS” to select all sections v a Physics topic code. The various other criteria use the wildcard personality (“*”) to pick records based on additional criteria. For example, under the Term ar you would use the criteria favor “2014*” to choose all records with a term password of 201420, 201430, and also 201430 (corresponding come summer, fall, and spring state in the 2013-14 academic year). Under the Days field you would use the contempt more complex criteria choose “*M*” or favor “*W*” to choose up any type of record through M or W anywhere in the field. Consisting of the * wildcard character both before and after the M and also W ensures the you acquire TWF and just W. Keep in mind that the criterion under the ar Schd_desc could likewise be coded together “Lecture” Or “Lab.”If you code the criteria on separate lines in the query, they duty as an OR condition. For example, the complying with query pulls every sections through a subject code of Physics ­or through a class form of “Lecture,” therefore you could have a Physics rap or a biology Lecture returned, among many various other possibilities.

Figure 4

Now, let’s say you desire to be able to select the topic code anytime you run the query, without having actually to difficult code it into the criteria field. In the case, you can use brackets <> come specify a user-entry criteria field. For example, the adhering to query prompts friend to go into a subject code, as specified in the criteria . Also, this query has actually a standard under the Term ar that will certainly return all corresponding records for the summer term. Once using the ? wildcard personality to select the summer term; this criteria ar pulls 201220, 201320, 201420, and so ~ above (the 20 suffix indicates a summer term). Each event of ? synchronizes to one and also only one character.

Figure 5

Running this query, girlfriend would check out a pop-up box matching to the criterion you gone into under the Subj_code field.

Figure 6

If you entered “ENGL” at the prompt, friend would see the following output:


Figure 7

As reflected above, just English courses available in the summer appear.

Using functional Criteria

Using the output from the original query (Figure 1 and 2 from the start of this article), a an easy criteria expression in the Subj_code field enables you to pick just those records corresponding the criteria (e.g. “MATH”). Friend could also use the wildcard character (“*”) to choose a variety of values; because that example, if you enter “2*” in the criteria ar for Crs_num you pick up just 200-level courses.This have the right to be quite useful, yet what if you want the option of consisting of all topic codes, in enhancement to gift able come select details subject codes? This gets a tiny bit trickier, however it deserve to be done making use of the adhering to syntax in the criteria field.

Figure 8

Under the Subj_code field you would get in the adhering to criterion:Like "*" & & "*"If you enter a details subject code at the prompt, speak MATH, the criteria ar is parsed as *MATH*, which would give you what you desire – in this situation the wildcard characters won’t affect the criteria. However if girlfriend don’t go into anything in ~ the prompt, the criteria field is parsed as **, i beg your pardon is simply the wildcard character, definition that all records are returned.Note the you would certainly include secondary criterion under the Actual_enroll field, as follows:

>=IIf(="Yes",0,20)Here, friend would usage the “IIf” keyword, i beg your pardon is provided for an if-then statement. The basic syntax is iif(condition, then a, else b). In this example, this default generates a 2nd prompt: “Include sections less than 20?” If you get in “Yes” climate the criteria is parsed together >=0 and also all documents are included. If you enter anything rather (e.g. “No”) climate the criteria is parsed as >=20 and only sections through an enrollment that 20 or much more are included.So, if girlfriend ran the query and entered “ENGL” together the an initial prompt and also “No” in ~ the second prompt, the output would look something prefer this:


Figure 9

As you deserve to see, results include only English courses v 20 or more students.

Using day Criteria


Figure 10

In this example, friend would encompass the complying with criterion under the Start_date field:DatePart("m",)=6This criterion extracts the month native Start_date and evaluates the to check out if it is same to 6 (i.e. June). Similarly, if you wanted to extract all records with a start day in calendar year 2012, you might use the following syntax:DatePart("yyyy",)=2012As an additional example, let’s say you want to extract every sections that were offered in the past two years. You can use the complying with criterion under the Start_date field:>DateAdd("yyyy",-2,Date())This criteria subtracts the present date, coded together Date(), native the year the the Start_date field, and also determines if the distinction is less than 2.

See more: How Many Grams Is 1/10 Of An Ounce Of Gold? 1/10 Oz American Gold Eagle Coin (Common Date)

Using Tables as Input

Let’s to speak you have the complying with very simple table, with just one record and also three fields, which could be supplied as the basic table for an input form:

Figure 11

After you enter the appropriate values right into the input form, you might then operation a query based on the values gone into into the form. The ask structure can look choose this:

Figure 12

Note the each criteria field references the corresponding field in the base table; note additionally that the two tables space not linked. Running this query would screen the adhering to output:

Figure 13

Only biological lecture sections offered in ax 201530 room included, as specified by the worths in the base table.There room also an ext advanced methods to usage the criteria field in Access, but these tips provide some simple applications that will certainly hopefully prove beneficial to accessibility users.