Using Option Buttons to Modify a Query

G

geoff.burkholder

I have a form with a subform that uses a Query as its 'Source Object'.
On the form there are 6 Option Buttons that I would like to use to
modify the Query Criteria. Each button would have a unique value (A,
C, E, H, P, or X), the Query Criteria would be modified to use from 0
(no Criteria => all records) through 6 buttons (all Criteria => all
records).

I also have 6 other buttons that I would like to use to sort the query
but if somebody can tell me how to do the above I may be able to
figure it out on my own.

Thanx
Geoff
 
K

KARL DEWEY

Here a couple of ways --
SELECT EMP.EMP, EMP.Name, EMP.LastName, EMP.FirstName, EMP.MI
FROM EMP
WHERE (((EMP.Name) Like "*") AND (([Forms]![YourForm]![Frame0])=0)) OR
(((EMP.MI) Like "*") AND (([Forms]![YourForm]![Frame0])=1)) OR (((EMP.Name)
Between "A" And "M") AND (([Forms]![YourForm]![Frame0])=2)) OR (((EMP.Name)
Between "N" And "Z") AND (([Forms]![YourForm]![Frame0])=3))
ORDER BY IIf([Forms]![YourForm]![Frame1]=0,[Name],[firstName]);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top