Article ID: 209645 - Last Review: July 28, 2004 - Revision: 1.2 How to use the Query by Form (QBF) technique in Access 2000This article was previously published under Q209645 For a Microsoft Access 2002 version of this article,
see
304428
(http://support.microsoft.com/kb/304428/EN-US/
)
. For a Microsoft Access 97 and earlier version of this article, see 95931 (http://support.microsoft.com/kb/95931/EN-US/ ) . Moderate: Requires basic macro, coding, and interoperability skills. This article applies only to a Microsoft Access database (.mdb). On This PageSUMMARY This article shows you how to use a form to specify the
criteria for a query. This technique is called query by form (QBF).
MORE INFORMATION In the QBF technique, you create a form in which you enter
query criteria. This form contains blank text boxes. Each text box represents a
field in a table that you want to query. You make entries only in the text
boxes for which you want to specify search criteria. The QBF form resembles a data entry form that has fields that match the fields in a table. A table that has fields for Name, Address, City, State, and Zip Code can have a QBF form that has corresponding fields. To select certain records, you can enter any combination of search criteria in the form. You can specify a city only, or a city and a state, or a zip code only, or any other combination. Fields that you leave blank are ignored. When you click a command button on the form, Access runs a query that uses the search criteria from your form. To use the QBF technique, follow these steps:
Notes on the QBF Parameter CriteriaThe sample QBF query in this article implements criteria in the query asForms!FormName!ControlName Or Forms!FormName!ControlName Is Null to filter the data. These criteria return all
matching records. If the criteria value is null, all the records are returned
for the specified field.You can specify any of the following alternative criteria to return slightly different results: NOTE: In the following sample criteria, an underscore (_) is used as a line-continuation character. Remove the underscore from the end of the line when you re-create these criteria.
210530
(http://support.microsoft.com/kb/210530/EN-US/
)
ACC2000: How to Create a Parameter In() Statement
209261
(http://support.microsoft.com/kb/209261/EN-US/
)
ACC2000: Showing All Records (Including Null) in a Parameter Query
| Article Translations
|
Back to the top
