Multiple Criteria from a List Box

B

Bob Barnes

Thanks to Allen Browne for a code example in using a List Box.

Part of the code included...
strWhere = strWhere & strDelim & .ItemData(varItem) & strDelim & ","

No problem building that from multiple selections from the List Box.

What I need is...from...
WHERE (((ABilling.MemStatus)=[Forms]![New Members]![AMemLists]) AND
((Left([LastName],1))=[Forms]![New Members]![ForBill]))....

The "AMemLists" is a Member Year (IE = 2007). I need to build multiple...
((Left([LastName],1))=[Forms]![New Members]![ForBill])), where it would be
like...

Left([LastName],1)="A" Or Left([LastName],1)="B" Or
Left([LastName],1)="C"...etc.


Back to Allen's example...
Remove trailing comma. Add field name, IN operator, and brackets.
lngLen = Len(strWhere) - 1
If lngLen > 0 Then
strWhere = "[CategoryID] IN (" & Left$(strWhere, lngLen) & ")"
lngLen = Len(strDescrip) - 2
If lngLen > 0 Then
strDescrip = "Categories: " & Left$(strDescrip, lngLen)
End If
End If

....where I open the Report with...

DoCmd.OpenReport strDoc, acViewPreview, WhereCondition:=strWhere,
OpenArgs:=strDescrip

TIA - Bob
 

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