Results 1 to 7 of 7
  1. #1
    white_flag is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    26

    list box with multiple criteria

    Hello

    I have an table with some records based on [company name], [name of the person] and [date]
    and if in one day [15.01.2009] I have to assign more persons to an company [name1; name2; name3]
    It is possible to insert this in an list box:
    ex:
    Company1|Name1;Name2;Name3
    Company2|Name4

    and the name1,name2 etc... to be connected to an form to see all the detaills from that person?


    see attachment

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    51,318
    Anything is possible. Might need some really fancy code, but could be done. By what criteria would the names be associated with a company?

    Consider using a combobox for Company and listbox for Names. The listbox could be a multi-select.

    VBA code will still be needed, but simpler than your original request.

    Look at http://allenbrowne.com/ser-50.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,443
    Why would you do that?

    I'm looking at the result in the list box when you click the date 1/15/2009 three items are returned, 2 in the same company.

    If you concantenate the two people associated with that company you can no longer use the primary key in the 'on click' event.

    On this form you
    1. Click a Date
    2. Click a Something in the list box
    3. ... what do you want to do with the result of clicking on the box?

    or is it there strictly to view results and you don't care about doing anything else with it?

    If you don't care about doing anything with it you can just order it by company then by name so all of the like companies are grouped together.

  4. #4
    white_flag is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    26
    thx guys for looking on this.
    The criteria of asociated names and company will be date.
    It is intresting an combo with an list box but in my case I need all records from one day to be filtert. I search on internet but for the moment, I have no luck.

    but in an list box it is not possible to insert more date in an "cell" with some "delimitation characters" Name1, Name2 .. etc

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,443
    I'm completely lost by the last post, I still don't understand why you'd want to concantenate names in a list box particularly if you were going to do anything at all with that list.

    The list box is already selecting records based on what date you select on the calendar control, all you'd have to do is sort those by company name or id or whatever to put them in an order that was useful to you, concantenating the fields is really not what you want to do IF YOU ARE GOING TO DO ANYTHING ELSE WITH THE DATA YOU SELECT FROM THE LIST BOX. But you didn't really answer that question from the last time I posted.

  6. #6
    white_flag is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    26
    the result will be later modify (so it will not be just for to view the results). I like your solution but I do not like that: the company name for example will be repeted

    company1 name1
    company1 name2
    company1 name3

    I would like

    company1 name1
    name2
    name3
    company2 name1
    name2
    name3

    etc.

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,443
    I don't know of a way to easily do that in a list box. But you can limit what shows in your list box to a specific company for instance if you had a list box with your companies and a list box with your names in a second, when you click on the list box with the companies only the names associated with that company would show up, could do it with a combo box too.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 07-13-2011, 11:00 AM
  2. Multiple criteria in DLookup
    By crowegreg in forum Forms
    Replies: 7
    Last Post: 06-22-2011, 01:47 AM
  3. Querie criteria with list
    By apsf68 in forum Access
    Replies: 1
    Last Post: 12-04-2010, 12:13 PM
  4. Replies: 6
    Last Post: 06-29-2010, 09:56 PM
  5. Creating a list viewed by 2 criteria
    By phillyon in forum Queries
    Replies: 0
    Last Post: 12-01-2008, 11:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums