Select the product you need help with
How to use the query by form (QBF) technique in Microsoft AccessArticle ID: 304428 - View products that this article applies to. This article was previously published under Q304428 For a Microsoft Access 2000 version of this article,
see
209645
(http://support.microsoft.com/kb/209645/
)
. For a Microsoft Access 97 and earlier version of this
article, see
95931
(http://support.microsoft.com/kb/95931/
)
. Moderate: Requires basic macro, coding, and interoperability skills. This article applies only to a Microsoft Access database (.accdb and .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.
REFERENCES For additional
information about parameter queries, click the following article numbers to
view the articles in the Microsoft Knowledge Base: 210530
(http://support.microsoft.com/kb/210530/
)
How to create a parameter In() statement
209261
(http://support.microsoft.com/kb/209261/
)
Showing all records (including null) in a parameter query
Properties | Article Translations
|


Back to the top








