Microsoft KB Archive/154506

= Works 3.0 FAQ: Database Querying Questions =

Article ID: 154506

Article Last Modified on 9/25/2003

-

APPLIES TO


 * Microsoft Works 3.0 Standard Edition
 * Microsoft Works 3.0a
 * Microsoft Works 3.0b

-



This article was previously published under Q154506



SUMMARY
This article contains answers to frequently asked Database query questions.



MORE INFORMATION
 Q. How do I perform text queries in Works?

A. In a very large database, it may be useful to perform a query that has Works display only records that match the criteria you specify.

For example, you can have Works show only records that have a value in a State field of WA, or only records for customers whose first name is Betty. The example below lists the steps to find all of the records containing "Betty" in the field "First Name,"

 On the Tools menu, click Create New Query. In the Choose A Field To Compare box, select the First Name field. In the How To Compare The Field Box, select the appropriate operator, for example, "Is Equal To" or "Contains". In the Value To Compare The Field To box, type the search target information. For example, Betty . Click Apply Now.</ol> </li> Q. How do I query on a blank field?

A. To find records which contain a blank in a specific field, follow these steps:

<ol> Follow steps 1-2 in Question 1 of this article.</li> In the How To Compare Field box, select Is Equal To, but leave the Compare The Field To box blank.</li> Click Apply Now.</li></ol> </li> Q. How do I query on a range of dates?

A. You can query on a range of dates by using the AND operator in conjunction with two comparison statements. For example, if you want to find all records whose date falls from 7/1/93 to 9/30/93, follow the steps below:

<ol> On the Tools menu, click Create New Query.</li> In the Choose A Field To Compare box, select the Date field.</li> In the How To Compare The Field box, select Is Greater Than Or Equal To.</li> In the Value To Compare The Field To box, type the starting range of the date:

7/1/93

</li> Click the AND operator between the first and second rows.</li> Repeat step 2 on the second row of query criteria.</li> On the second row of query criteria, repeat step 3, but select Is Less Than Or Equal To.</li> On the second row of query criteria, repeat step 4 but type the ending range of the date:

9/30/93

</li> Click Apply Now.</li></ol> </li> Q. How do I query on a specific month?

A. In the Works database module, you can query for dates that fall in a particular month with the MONTH function. The MONTH function returns an integer from 1 to 12 specifying the month of the given date. For example, if you need to find records that have May in a field named "Birthday," use the steps below:

<ol> On the Tools menu, click Create New Query.</li> <li>Click Query View.</li> <li>Press DELETE to remove any formula that appears.</li> <li>In the Birthday field, type the following formula:

=month=5

</li> <li>On the View menu, click List to see the results of your query.

NOTE: The examples in this question match all records where a date entry contains a month of May, regardless of the year. To find records in a certain year, use the YEAR function. For example, to find records only for May of 1995, use the following formula:

=month(birthday)=5#and#year(birthday)=95

</li></ol> </li></ol>

Additional query words: w_works faqs facs f.a.q. ranges queried searches searching locating sorting

Keywords: kbinfo KB154506

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.