How do I create a query in design view with a variable? If I want the user
to type in a "LastName" from the Customers table when the query runs, how
can I set that up?
Thanks
Use a Parameter Query: on the criteria line put
[Enter last name:]
or, better, create a little unbound form named frmCrit; put a Combo
Box on it selecting all the customer ID's and displaying their names;
for instance a query like
SELECT CustomerID, LastName & ", " & FirstName
FROM Customers
ORDER BY LastName, FirstName;
Create a Combo Box cboCustomer on frmCrit using this query; then use a
query criterion of
=Forms![frmCrit]![cboCustomer]
on the CustomerID field of your query.
John W. Vinson[MVP]