OutputAllFields Property Example

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
strGetSQL = "SELECT * FROM Shippers"
Forms!Form1.RecordSource = strGetSQL
Text1.ControlSource = "ShipperID"
Text2.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 enter this SQL statement in SQL view of the Query window.

SELECT * FROM Suppliers INNER JOIN Products
ON Suppliers.[SupplierID] = Products.[SupplierID]
ORDER BY Suppliers.[CompanyName], Products.[ProductName];