That's what I'm trying to say: I don't understand what Dev meant when he
said you could. I can't think of how you'd do it...
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Right, I got that too. My question is: How do I create the query then to
USE
what is in that text box, where do I put the
"[Forms]![frmMyForm]![txtTextBox] reference?
--
Never give up, the answer IS out there, it just takes a while to find it
sometimes!
:
Whether or not a control is hidden doesn't change how you refer to it.
However, having said that, I'm not quite sure what Dev had in mind when
he
said you could manually assign the complete WHERE clause to a hidden
control.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Thanks for the info - it does the trick!
My other problem then is how do I get the query to reference what is
in
the
invisble text box? Since it is a complete SQL statement?
--
Never give up, the answer IS out there, it just takes a while to find
it
sometimes!
:
Since the AfterUpdate event will occur with each selection, you're
best
off
having a button for the user to click on when they've finished
making
selections, and put the code in that button's Click event.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Would this code go into the AfterUpdate event or somewhere else?
--
Never give up, the answer IS out there, it just takes a while to
find
it
sometimes!
:
Combo boxes do not allow more than one selection. End of
discussion.
Only List boxes allow you to make more than one selection (and
not
by
default: you have to set the control's MultiSelect property to
either
Simple
or Extended).
If by "how do I use the ItemSelected property in the query?" you
mean is
there some way for a query to refer to a list box set for
MultiSelect
and
use what's selected as its criteria, the answer is no, at least,
not
directly.
http://www.mvps.org/access/forms/frm0007.htm at "The Access Web"
shows
one
way how you can alter the SQL associated with a query to accept
multiselected items from a list box, although to be honest, I
prefer:
Dim frm As Form, ctl As Control
Dim varItem As Variant
Dim strSQL As String
Set frm = Form!frmMyForm
Set ctl = frm!lbMultiSelectListbox
If ctl.ItemsSelected.Count > 0 Then
strSQL = "Select * from Employees where [EmpID] IN ("
For Each varItem In ctl.ItemsSelected
strSQL = strSQL & ctl.ItemData(varItem) & ", "
Next varItem
strSQL=Left$(strSQL,Len(strSQL)-2)) & ")"
End If
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Well I guess now the question is how do I use the ItemSelected
property in
the query?
--
Never give up, the answer IS out there, it just takes a while
to
find
it
sometimes!
:
Is there a way to make a Combo Box accept multiple
selections?
I have a table that has look-up values for two fields, and I
want
users
to
be able to print a report with more than one of these
options.
If anyone has any suggestions about how to do this I would
appreciate
it.
--
Never give up, the answer IS out there, it just takes a
while to
find it
sometimes!