Using option group AND multi-select list box in query

G

Gntlhnds

I have read several posts about using multi-select list boxes in a query.
The problem is, I have a dialog box with an option group on it. Options 5 &
6 enable multi-select list boxes. Upon pressing the preview button on the
form, it opens a report that is based on a query. Here is the SQL that I
have right now:

Dialog Form = "frmAlphaReportsDialog"
Query = "qryAlphaReports", based on table "Contacts"
Option Group = "ReportShow"
List15 = Option 5
List17 = Option 6

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))
ORDER BY Contacts.LastName;

Options 1-4 work, but unfortunately, options 5 & 6 don't work, whether I
have only one selection or many. I think Option 6 isn't working at all
because the list is formatted mmm/yy whereas the data in the query is
formatted mm/dd/yy. I have seen plenty of code for using the multi-select
list boxes, but I have not idea where to put it and how to incorporate it
into the query I have now. Can anyone help?
 

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