Query.
You can use the OutputAllFields property to show all fields in the query’s underlying data source and in the field list of a form or report. Setting this property is an easy way to show all fields without having to check the Show box in the query design grid for each field in the query.
Note The OutputAllFields property applies only to append, make-table, and select queries.
The OutputAllFields property uses the following settings.
Setting |
Description |
Yes |
Displays all the fields in the underlying tables and in the field list of a form or report. |
No |
(Default) Displays only fields having the Show box selected in the query design grid. |
You can set this property in the query property sheet or in SQL view of the Query window.
Note An asterisk (*) in the SQL statement in place of a field name is the equivalent of setting the OutputAllFields property to Yes.
When OutputAllFields is set to Yes, the only fields you need to include in the query design grid are those that you want to sort on or specify criteria for.
When you save a filter as a query, Microsoft Access sets OutputAllFields to Yes.
The following example uses an asterisk in an SQL statement to select all the fields in the Shippers table. It then displays the fields in text boxes on a form by setting the ControlSource property for the text boxes to the names of the individual fields in the query.
Dim strGetSQL AS String= "SELECT * FROM Shippers"!Form1.RecordSource = strGetSQL.ControlSource = "ShipperID".ControlSource = "CompanyName"
In the output for the next SQL statement, the values in the CompanyName and ProductName fields are sorted in ascending order, and all the fields in the Suppliers and Products tables are displayed in the field lists and in Datasheet view. You can enter this SQL statement in SQL view of the Query window.
SELECT DISTINCTROW *Suppliers JOIN Products ON Suppliers.[SupplierID] = Products.[SupplierID]BY Suppliers.[CompanyName], Products.[ProductName];