Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Combo Box - Multiple Selections

Discussion in 'Information Technology' started by Larry G., Jul 28, 2006.

  1. Larry G.

    Larry G.
    Expand Collapse
    Guest

    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!
     
  2. Loading...


  3. Larry G.

    Larry G.
    Expand Collapse
    Guest

    Never mind, I found it~
    --
    Never give up, the answer IS out there, it just takes a while to find it
    sometimes!


    "Larry G." wrote:

    > 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!
     
  4. Larry G.

    Larry G.
    Expand Collapse
    Guest

    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!


    "Larry G." wrote:

    > 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!
     
  5. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    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
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    news:DB13B4FD-25C4-4C3F-8722-34BE6F6F4242@microsoft.com...
    > 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!
    >
    >
    > "Larry G." wrote:
    >
    > > 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!
     
  6. Larry G.

    Larry G.
    Expand Collapse
    Guest

    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!


    "Douglas J Steele" wrote:

    > 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
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > news:DB13B4FD-25C4-4C3F-8722-34BE6F6F4242@microsoft.com...
    > > 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!
    > >
    > >
    > > "Larry G." wrote:
    > >
    > > > 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!

    >
    >
    >
     
  7. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    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
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    news:EFAD767A-E503-4A6A-970C-1553564BABB6@microsoft.com...
    > 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!
    >
    >
    > "Douglas J Steele" wrote:
    >
    > > 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
    > > http://I.Am/DougSteele
    > > (no e-mails, please!)
    > >
    > >
    > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > news:DB13B4FD-25C4-4C3F-8722-34BE6F6F4242@microsoft.com...
    > > > 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!
    > > >
    > > >
    > > > "Larry G." wrote:
    > > >
    > > > > 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!

    > >
    > >
    > >
     
  8. Larry G.

    Larry G.
    Expand Collapse
    Guest

    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!


    "Douglas J Steele" wrote:

    > 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
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > news:EFAD767A-E503-4A6A-970C-1553564BABB6@microsoft.com...
    > > 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!
    > >
    > >
    > > "Douglas J Steele" wrote:
    > >
    > > > 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
    > > > http://I.Am/DougSteele
    > > > (no e-mails, please!)
    > > >
    > > >
    > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > news:DB13B4FD-25C4-4C3F-8722-34BE6F6F4242@microsoft.com...
    > > > > 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!
    > > > >
    > > > >
    > > > > "Larry G." wrote:
    > > > >
    > > > > > 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!
    > > >
    > > >
    > > >

    >
    >
    >
     
  9. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    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
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    news:91F3AA79-7AE0-4D35-B383-7EC482991963@microsoft.com...
    > 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!
    >
    >
    > "Douglas J Steele" wrote:
    >
    > > 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
    > > http://I.Am/DougSteele
    > > (no e-mails, please!)
    > >
    > >
    > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > news:EFAD767A-E503-4A6A-970C-1553564BABB6@microsoft.com...
    > > > 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!
    > > >
    > > >
    > > > "Douglas J Steele" wrote:
    > > >
    > > > > 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
    > > > > http://I.Am/DougSteele
    > > > > (no e-mails, please!)
    > > > >
    > > > >
    > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > > news:DB13B4FD-25C4-4C3F-8722-34BE6F6F4242@microsoft.com...
    > > > > > 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!
    > > > > >
    > > > > >
    > > > > > "Larry G." wrote:
    > > > > >
    > > > > > > 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!
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >
     
  10. Larry G.

    Larry G.
    Expand Collapse
    Guest

    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!


    "Douglas J Steele" wrote:

    > 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
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > news:91F3AA79-7AE0-4D35-B383-7EC482991963@microsoft.com...
    > > 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!
    > >
    > >
    > > "Douglas J Steele" wrote:
    > >
    > > > 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
    > > > http://I.Am/DougSteele
    > > > (no e-mails, please!)
    > > >
    > > >
    > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > news:EFAD767A-E503-4A6A-970C-1553564BABB6@microsoft.com...
    > > > > 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!
    > > > >
    > > > >
    > > > > "Douglas J Steele" wrote:
    > > > >
    > > > > > 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
    > > > > > http://I.Am/DougSteele
    > > > > > (no e-mails, please!)
    > > > > >
    > > > > >
    > > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > > > news:DB13B4FD-25C4-4C3F-8722-34BE6F6F4242@microsoft.com...
    > > > > > > 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!
    > > > > > >
    > > > > > >
    > > > > > > "Larry G." wrote:
    > > > > > >
    > > > > > > > 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!
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >
     
  11. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    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
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    news:BEC1FB83-DE05-4DE2-B01D-5E28ABB20257@microsoft.com...
    > 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!
    >
    >
    > "Douglas J Steele" wrote:
    >
    > > 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
    > > http://I.Am/DougSteele
    > > (no e-mails, please!)
    > >
    > >
    > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > news:91F3AA79-7AE0-4D35-B383-7EC482991963@microsoft.com...
    > > > 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!
    > > >
    > > >
    > > > "Douglas J Steele" wrote:
    > > >
    > > > > 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
    > > > > http://I.Am/DougSteele
    > > > > (no e-mails, please!)
    > > > >
    > > > >
    > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > > news:EFAD767A-E503-4A6A-970C-1553564BABB6@microsoft.com...
    > > > > > 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!
    > > > > >
    > > > > >
    > > > > > "Douglas J Steele" wrote:
    > > > > >
    > > > > > > 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
    > > > > > > http://I.Am/DougSteele
    > > > > > > (no e-mails, please!)
    > > > > > >
    > > > > > >
    > > > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > > > > news:DB13B4FD-25C4-4C3F-8722-34BE6F6F4242@microsoft.com...
    > > > > > > > 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!
    > > > > > > >
    > > > > > > >
    > > > > > > > "Larry G." wrote:
    > > > > > > >
    > > > > > > > > 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!
    > > > > > >
    > > > > > >
    > > > > > >
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >
     
  12. Larry G.

    Larry G.
    Expand Collapse
    Guest

    LOL - OK thanks! I am taking a different approach anyway now - I think I am
    going to try for the parameter in the query "Like
    [Forms]![MyForm]![txtParameter], and have the value of the parameter read
    "*Parameter1*" OR "Parameter2"

    --
    Never give up, the answer IS out there, it just takes a while to find it
    sometimes!


    "Douglas J Steele" wrote:

    > 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
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > news:BEC1FB83-DE05-4DE2-B01D-5E28ABB20257@microsoft.com...
    > > 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!
    > >
    > >
    > > "Douglas J Steele" wrote:
    > >
    > > > 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
    > > > http://I.Am/DougSteele
    > > > (no e-mails, please!)
    > > >
    > > >
    > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > news:91F3AA79-7AE0-4D35-B383-7EC482991963@microsoft.com...
    > > > > 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!
    > > > >
    > > > >
    > > > > "Douglas J Steele" wrote:
    > > > >
    > > > > > 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
    > > > > > http://I.Am/DougSteele
    > > > > > (no e-mails, please!)
    > > > > >
    > > > > >
    > > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > > > news:EFAD767A-E503-4A6A-970C-1553564BABB6@microsoft.com...
    > > > > > > 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!
    > > > > > >
    > > > > > >
    > > > > > > "Douglas J Steele" wrote:
    > > > > > >
    > > > > > > > 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
    > > > > > > > http://I.Am/DougSteele
    > > > > > > > (no e-mails, please!)
    > > > > > > >
    > > > > > > >
    > > > > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > > > > > news:DB13B4FD-25C4-4C3F-8722-34BE6F6F4242@microsoft.com...
    > > > > > > > > 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!
    > > > > > > > >
    > > > > > > > >
    > > > > > > > > "Larry G." wrote:
    > > > > > > > >
    > > > > > > > > > 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!
    > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >
     
  13. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    Unfortunately, that won't work.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    news:415AC08B-A188-42D1-8628-9AED86EBACB7@microsoft.com...
    > LOL - OK thanks! I am taking a different approach anyway now - I think I

    am
    > going to try for the parameter in the query "Like
    > [Forms]![MyForm]![txtParameter], and have the value of the parameter read
    > "*Parameter1*" OR "Parameter2"
    >
    > --
    > Never give up, the answer IS out there, it just takes a while to find it
    > sometimes!
    >
    >
    > "Douglas J Steele" wrote:
    >
    > > 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
    > > http://I.Am/DougSteele
    > > (no e-mails, please!)
    > >
    > >
    > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > news:BEC1FB83-DE05-4DE2-B01D-5E28ABB20257@microsoft.com...
    > > > 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!
    > > >
    > > >
    > > > "Douglas J Steele" wrote:
    > > >
    > > > > 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
    > > > > http://I.Am/DougSteele
    > > > > (no e-mails, please!)
    > > > >
    > > > >
    > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > > news:91F3AA79-7AE0-4D35-B383-7EC482991963@microsoft.com...
    > > > > > 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!
    > > > > >
    > > > > >
    > > > > > "Douglas J Steele" wrote:
    > > > > >
    > > > > > > 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
    > > > > > > http://I.Am/DougSteele
    > > > > > > (no e-mails, please!)
    > > > > > >
    > > > > > >
    > > > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > > > > news:EFAD767A-E503-4A6A-970C-1553564BABB6@microsoft.com...
    > > > > > > > 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!
    > > > > > > >
    > > > > > > >
    > > > > > > > "Douglas J Steele" wrote:
    > > > > > > >
    > > > > > > > > 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
    > > > > > > > > http://I.Am/DougSteele
    > > > > > > > > (no e-mails, please!)
    > > > > > > > >
    > > > > > > > >
    > > > > > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in

    message
    > > > > > > > > news:DB13B4FD-25C4-4C3F-8722-34BE6F6F4242@microsoft.com...
    > > > > > > > > > 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!
    > > > > > > > > >
    > > > > > > > > >
    > > > > > > > > > "Larry G." wrote:
    > > > > > > > > >
    > > > > > > > > > > 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!
    > > > > > > > >
    > > > > > > > >
    > > > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >
     
  14. Larry G.

    Larry G.
    Expand Collapse
    Guest

    I may not have explained it correctly, but it does work the way I envisioned
    it. I had to add a second invisible text box, named txtParam2, and then added
    an OR line in the query to look at what is in there, if it is null, it only
    returns what is in the txtParam1 box. So if the user selects radio button 1
    or 2 from the frame, then either one of these will appear in Param1 *Received
    from IDEM* or *Submitted to IDEM*, if the user select option 3, then in Param
    1 is *Received from IDEM* and Param2 is *Submitted to IDEM*. When the user
    clicks the run query button, the query runs, it looks at both text boxes but
    if one is null it does not return a result. I think this would only work for
    three or less options though.
    --
    Never give up, the answer IS out there, it just takes a while to find it
    sometimes!


    "Douglas J Steele" wrote:

    > Unfortunately, that won't work.
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > news:415AC08B-A188-42D1-8628-9AED86EBACB7@microsoft.com...
    > > LOL - OK thanks! I am taking a different approach anyway now - I think I

    > am
    > > going to try for the parameter in the query "Like
    > > [Forms]![MyForm]![txtParameter], and have the value of the parameter read
    > > "*Parameter1*" OR "Parameter2"
    > >
    > > --
    > > Never give up, the answer IS out there, it just takes a while to find it
    > > sometimes!
    > >
    > >
    > > "Douglas J Steele" wrote:
    > >
    > > > 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
    > > > http://I.Am/DougSteele
    > > > (no e-mails, please!)
    > > >
    > > >
    > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > news:BEC1FB83-DE05-4DE2-B01D-5E28ABB20257@microsoft.com...
    > > > > 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!
    > > > >
    > > > >
    > > > > "Douglas J Steele" wrote:
    > > > >
    > > > > > 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
    > > > > > http://I.Am/DougSteele
    > > > > > (no e-mails, please!)
    > > > > >
    > > > > >
    > > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > > > news:91F3AA79-7AE0-4D35-B383-7EC482991963@microsoft.com...
    > > > > > > 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!
    > > > > > >
    > > > > > >
    > > > > > > "Douglas J Steele" wrote:
    > > > > > >
    > > > > > > > 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
    > > > > > > > http://I.Am/DougSteele
    > > > > > > > (no e-mails, please!)
    > > > > > > >
    > > > > > > >
    > > > > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > > > > > news:EFAD767A-E503-4A6A-970C-1553564BABB6@microsoft.com...
    > > > > > > > > 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!
    > > > > > > > >
    > > > > > > > >
    > > > > > > > > "Douglas J Steele" wrote:
    > > > > > > > >
    > > > > > > > > > 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
    > > > > > > > > > http://I.Am/DougSteele
    > > > > > > > > > (no e-mails, please!)
    > > > > > > > > >
    > > > > > > > > >
    > > > > > > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in

    > message
    > > > > > > > > > news:DB13B4FD-25C4-4C3F-8722-34BE6F6F4242@microsoft.com...
    > > > > > > > > > > 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!
    > > > > > > > > > >
    > > > > > > > > > >
    > > > > > > > > > > "Larry G." wrote:
    > > > > > > > > > >
    > > > > > > > > > > > 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!
    > > > > > > > > >
    > > > > > > > > >
    > > > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > > > >
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >
     
  15. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    Yes, that would work.

    You could use

    LIKE Nz(Forms![MyForm]![MyControl], "*")

    or

    LIKE Forms![MyForm]![MyControl] OR (Forms![MyForm]![MyControl] IS NULL)

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    news:564F89AD-37BF-4674-9B83-2942BF99CD5F@microsoft.com...
    > I may not have explained it correctly, but it does work the way I

    envisioned
    > it. I had to add a second invisible text box, named txtParam2, and then

    added
    > an OR line in the query to look at what is in there, if it is null, it

    only
    > returns what is in the txtParam1 box. So if the user selects radio button

    1
    > or 2 from the frame, then either one of these will appear in Param1

    *Received
    > from IDEM* or *Submitted to IDEM*, if the user select option 3, then in

    Param
    > 1 is *Received from IDEM* and Param2 is *Submitted to IDEM*. When the user
    > clicks the run query button, the query runs, it looks at both text boxes

    but
    > if one is null it does not return a result. I think this would only work

    for
    > three or less options though.
    > --
    > Never give up, the answer IS out there, it just takes a while to find it
    > sometimes!
    >
    >
    > "Douglas J Steele" wrote:
    >
    > > Unfortunately, that won't work.
    > >
    > > --
    > > Doug Steele, Microsoft Access MVP
    > > http://I.Am/DougSteele
    > > (no e-mails, please!)
    > >
    > >
    > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > news:415AC08B-A188-42D1-8628-9AED86EBACB7@microsoft.com...
    > > > LOL - OK thanks! I am taking a different approach anyway now - I think

    I
    > > am
    > > > going to try for the parameter in the query "Like
    > > > [Forms]![MyForm]![txtParameter], and have the value of the parameter

    read
    > > > "*Parameter1*" OR "Parameter2"
    > > >
    > > > --
    > > > Never give up, the answer IS out there, it just takes a while to find

    it
    > > > sometimes!
    > > >
    > > >
    > > > "Douglas J Steele" wrote:
    > > >
    > > > > 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
    > > > > http://I.Am/DougSteele
    > > > > (no e-mails, please!)
    > > > >
    > > > >
    > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > > news:BEC1FB83-DE05-4DE2-B01D-5E28ABB20257@microsoft.com...
    > > > > > 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!
    > > > > >
    > > > > >
    > > > > > "Douglas J Steele" wrote:
    > > > > >
    > > > > > > 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
    > > > > > > http://I.Am/DougSteele
    > > > > > > (no e-mails, please!)
    > > > > > >
    > > > > > >
    > > > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in message
    > > > > > > news:91F3AA79-7AE0-4D35-B383-7EC482991963@microsoft.com...
    > > > > > > > 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!
    > > > > > > >
    > > > > > > >
    > > > > > > > "Douglas J Steele" wrote:
    > > > > > > >
    > > > > > > > > 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
    > > > > > > > > http://I.Am/DougSteele
    > > > > > > > > (no e-mails, please!)
    > > > > > > > >
    > > > > > > > >
    > > > > > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in

    message
    > > > > > > > > news:EFAD767A-E503-4A6A-970C-1553564BABB6@microsoft.com...
    > > > > > > > > > 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!
    > > > > > > > > >
    > > > > > > > > >
    > > > > > > > > > "Douglas J Steele" wrote:
    > > > > > > > > >
    > > > > > > > > > > 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
    > > > > > > > > > > http://I.Am/DougSteele
    > > > > > > > > > > (no e-mails, please!)
    > > > > > > > > > >
    > > > > > > > > > >
    > > > > > > > > > > "Larry G." <LarryG@discussions.microsoft.com> wrote in

    > > message
    > > > > > > > > > >

    news:DB13B4FD-25C4-4C3F-8722-34BE6F6F4242@microsoft.com...
    > > > > > > > > > > > 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!
    > > > > > > > > > > >
    > > > > > > > > > > >
    > > > > > > > > > > > "Larry G." wrote:
    > > > > > > > > > > >
    > > > > > > > > > > > > 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!
    > > > > > > > > > >
    > > > > > > > > > >
    > > > > > > > > > >
    > > > > > > > >
    > > > > > > > >
    > > > > > > > >
    > > > > > >
    > > > > > >
    > > > > > >
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >
     

Share This Page