Mulit_select Box

  • Thread starter Thread starter Tom Olsen
  • Start date Start date
T

Tom Olsen

All

If a user selects mulitpule criteria from a Listbox
(extended property) . What criteria do you put in the
query so that multipule criteria is retrived.

Thanks ,

Tom Olsen
 
I would like to include the critera in a query as QBE
Criteria. Pointing to the list box and pulling the
mulitpule criteria.
-----Original Message-----
Take a look at the following articles - you didn't specify where you want to
use this criteria but hopefully these articles will get you started.

http://www.mvps.org/access/forms/frm0007.htm

How to Use a Multi-Select List Box to Filter a Form
http://support.microsoft.com/default.aspx?scid=kb; [LN];135546
--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.


Tom said:
All

If a user selects mulitpule criteria from a Listbox
(extended property) . What criteria do you put in the
query so that multipule criteria is retrived.

Thanks ,

Tom Olsen

.
 
I need the syntax for querydef

-----Original Message-----
I would like to include the critera in a query as QBE
Criteria. Pointing to the list box and pulling the
mulitpule criteria.
-----Original Message-----
Take a look at the following articles - you didn't specify where you want to
use this criteria but hopefully these articles will get you started.

http://www.mvps.org/access/forms/frm0007.htm

How to Use a Multi-Select List Box to Filter a Form
http://support.microsoft.com/default.aspx?scid=kb; [LN];135546
this
newsgroup.




.
.
 
You can't use the query grid to do this. So, the code behind the button to
print the report will look like:

Dim mysel As Variant
Dim iptr As Integer
Dim strMyWhere As String

For Each mysel In Me.lstMyListBox.ItemsSelected
iptr = CInt(mysel)
If strMyWhere <> "" Then strMyWhere = strMyWhere & ","
strMyWhere = strMyWhere & Me.lstMyListBox.Column(0, iptr)
Next mysel

if strMyWhere <> "" then
strMyWhere = "CustomerId in (" & strMywhere & ")"
endif

docmd.OpenForm "Your report",acViewPreview,,strMyWhere


End Sub


The above means you remove all parameters from the query. In fact, you will
find this much better, as now you don't have to attached each query to some
stupid hard to use expression. (this allows you to re-use the query in more
then one report etc.).

Here is some screen shots of the above idea in action.

http://www.attcanada.net/~kallal.msn/ridesrpt/ridesrpt.html
 
Back
Top