Some of the following examples assume the existence of a hypothetical Salary field in an Employees table. Note that this field does not actually exist in the Northwind database Employees table.
This example creates a dynaset-type Recordset based on an SQL statement that selects the LastName and FirstName fields of all records in the Employees table. It calls the EnumFields procedure, which prints the contents of a Recordset object to the Debug window.
SELECT LastName, FirstName FROM Employees;
This example counts the number of records that have an entry in the PostalCode field and names the returned field Tally.
SELECT Count (PostalCode) AS Tally FROM Customers;
This example shows the number of employees and the average and maximum salaries.
SELECT Count (*)AS TotalEmployees,
Avg(Salary) AS AverageSalary,
Max(Salary) AS MaximumSalary FROM Employees;