Using Combo Box in a Query to run report

iainmid

Registered User.
Local time
Today, 17:32
Joined
Mar 1, 2007
Messages
35
How do i create a parameter to use a combo box instead of just typing a value in my sql statement to run a report.

I know you can do it from a combo box on a form that the parameter in the sql statement point to but i just want to do this from the sql query itself.

This is the sql statement i have so far but i need the parameter as a combo box to select either Male, Female or Both

SELECT Contacts.*, Contacts.Gender
FROM Contacts
WHERE (((Contacts.Gender)=[Select Gender]));
 
How do i create a parameter to use a combo box instead of just typing a value in my sql statement to run a report.

I know you can do it from a combo box on a form that the parameter in the sql statement point to but i just want to do this from the sql query itself.

This is the sql statement i have so far but i need the parameter as a combo box to select either Male, Female or Both

SELECT Contacts.*, Contacts.Gender
FROM Contacts
WHERE (((Contacts.Gender)=[Select Gender]));

Try

SELECT Contacts.*, Contacts.Gender
FROM Contacts
WHERE (((Contacts.Gender)=[Combo1]))

Where Combo1 is the name of the combo box.
Note: the form containing the combo box must be open when you run this.
 

Users who are viewing this thread

Back
Top Bottom