Results 1 to 11 of 11
  1. #1
    Join Date
    Oct 2004
    Posts
    7

    Exclamation Unanswered: How to link a Multiple choice list box to a query

    I would like to know the fastest way to link a multiple choice list box to a query. Furthermore how to make sure that the items selcted through the list box will be taken into account by the query.
    Thanks
    HUJA

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Me.yourListBox.RowSource="yourQuery"
    The output of your query will be displayed in the listbox

  3. #3
    Join Date
    Oct 2004
    Posts
    7

    Unhappy List box

    When I select the items in the list box (multiple selection activated) the items chosen are not taken into consideration by the query in the criteria parameters. Why?

    In other words I would like to have a query that upon selected items in the list box will list the records matching the criteria set by the list box.
    Thanks

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb

    Use something like that

    PHP Code:
       For Each Item In yourListBox.ItemsSelected
         output 
    output yourListBox.ItemData(selectedItem) & ","
       
    Next 
    Out put will contain what you have selected, and separated with commas

  5. #5
    Join Date
    Oct 2004
    Posts
    7

    Unhappy

    [QUOTE=hammbakka]Use something like that


    PHP Code:
       For Each Item In yourListBox.ItemsSelected
         output 
    output yourListBox.ItemData(selectedItem) & ","
       
    Next 
    Where shall I put this??
    I am not an expert and therefore a littel bit more information would help me.
    Definitively what I want to do is beyond my capacities.
    From what I understand I have to use code builder????

  6. #6
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    I'll send you an example

  7. #7
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb

    In that example just choose you fields you want from the listbox then click the button to see the selected items separated with comma
    Attached Files Attached Files

  8. #8
    Join Date
    Oct 2004
    Posts
    7

    List box to query

    Thank you, with few adjustments I had made it work to transfer the list box to the unbound text box. Difficult is now to link the query to the unbound text box because the query won't take into consideration the content.
    You have an idea??
    Thanks again

  9. #9
    Join Date
    Jul 2004
    Location
    Inverurie
    Posts
    628
    =[Forms]![<form name>]![<unbound textbox name>].value

    Edit: Put this in the criteria part of the query.
    Last edited by cruickshanks; 10-21-04 at 12:26.

  10. #10
    Join Date
    Oct 2004
    Posts
    7

    list box

    thanks but this doesn't work for more than one record, it is more than na hour I amtrying to circumnavigate the problem.

    I make you an example:
    in the list box I have:
    MLG1.2.1
    MLG1.2.2
    ETC...
    with your help the selected items are going to the unbound text box as:

    MLG1.2.1, MLG1.2.2

    The query parameter doesn't like the comma (,) and it won't show anything.

    Thanks again

  11. #11
    Join Date
    Jul 2004
    Location
    Inverurie
    Posts
    628
    have you tried the vb code "queryname".requery? (not sure if that actually works, but it's worth a shot).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •