Multi-Select List box AND option group in criteria for query

G

Gntlhnds

I have a dialog form (frmAlphaReportsDialog) with an option group
(ReportShow) that has six buttons. The last two enable multi-select List
Boxes (List15 and List17). After selecting an option and pressing
btnAlphaRosterPreview, a report is generated (Alphabetical Contact Report).
This report gets its data from a query (qryAlphaRoster) which gets its data
from a table (Contacts). If one of the first four options are selected, the
right report is shown. If one of the last two options are selected, then the
report is blank, no matter how many selections are highlighted in the list
boxes. List17 has a list of dates and is formatted mmm/yy and gets its data
from a query as well (qryCheckInDate). The field that qryCheckInDate gets
its data from is formatted mm/dd/yy, which is why I believe that List17
doesn't work. I've searched and found lots of code for using multi-select
list boxes for a query, but I don't know how to incorporate it into my
scenario. Here is my SQL statement for qryAlphaRoster:

SELECT Contacts.LastName, Contacts.FirstName, Contacts.Rank,
Contacts.[Battery/Section], Contacts.ContactTypeID, Contacts.Religion,
Contacts.MaritalStatus, Contacts.ChildrenNames, Contacts.CheckIn,
Contacts.DateModified

FROM Contacts
WHERE (((Contacts.Paygrade) Like "*") AND
(([forms]![frmAlphaRosterDialog]![ReportShow])=1)) OR
(((Contacts.Paygrade)>'E5') AND
(([forms]![frmAlphaRosterDialog]![ReportShow])=2)) OR
(((Contacts.Paygrade)>'O0') AND
(([forms]![frmAlphaRosterDialog]![ReportShow])=3)) OR
(((Contacts.Paygrade)<'E6') AND
(([forms]![frmAlphaRosterDialog]![ReportShow])=4)) OR (((Contacts.Rank) Like
[forms]![frmAlphaRosterDialog]![List15]) AND
(([forms]![frmAlphaRosterDialog]![ReportShow])=5)) OR
(((Contacts.CheckIn)=[Forms]![frmAlphaRosterDialog]![List17]) AND
(([forms]![frmAlphaRosterDialog]![ReportShow])=6))

Anybody know where I should put in which code for utilizing the multi-select
list boxes properly?
 

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