Results 1 to 5 of 5
  1. #1
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,067

    Multi Column Combo Box choices set in VBA


    I have a multi Column Combo box I'm trying to set the choices in VBA. I can get it to populate 1 column with
    Me.cbo_eventdate.AddItem (rs!EventDate)

    but how do I get it to populate the second column .AddItem only gives me the 1 column. I know I've done this before in Access 2003 but that was 8 years ago and I don't remember the command structure to do it and Help is not helping. Any advice is appreciated.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    combo box is feed from query/table.
    run an append query to add the value to the table , and it will show list. (after refresh)

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    combo box is feed from query/table.
    Not always - value lists are another option.

    Here is a link that explains .AddItem : https://msdn.microsoft.com/en-us/lib.../ff835377.aspx

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    And I guess the question, here, would be why the OP is using a ValueList as the Row Source Type (as the use of AddItem suggests) if, as is apparent from the use of

    rs!EventDate

    instead of the Table or Query that holds the data?

    At any rate, using literal strings for the AddItem, the syntax would be

    Me.ListboxName.AddItem "FirstColumnItem;SecondColumnItem"

    Linq ;0)>

    with a semi-colon between the column items.

    John_G is correct, of course, you can use a ValueList instead of a Table/Query. Generally, you should only use a ValueList if the is very little possibility that the choices will ever, ever, ever change! Doing so, with a ValueList requires going back into Design Mode to make the modification...whereas with a Table/Query based Combobox/Listbox, you can simply add data to the Table/Query.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,067
    Maybe I didn't explain this correctly.
    I have a main form with member demographic information we have various events that the member may attend multiple times. We have multiple events on different days. What I'm trying to do is I have a subform that lists all of the events and when the member attended them The sub form is a datasheet so let's say member sam jones attends the Monthly Member services event in Jan and the bi-monthly bingo event in Feb and April. He should have 3 records

    Event Attendance Date
    Member Services Jan 15, 2016
    Bingo Feb 10, 2016
    Bingo March 9, 2016


    When the combo box for the event is selected and changed whether for an existing record or a new record the Attendance Date combo box should display only the dates that event occurred. One is selected and that is displayed from now on

    What's happening is if there are more than 1 Event the dates for all event's are showing blank because as soon as a new event is selected the combo box only displays the choices for that event and clears all dates for other events. Originally I used a table for this form with a query as the Rowsource for this combo box but that was the issue I had. I thought maybe an unbound combo box would do what I wanted it to but it doesn't. Any thoughts how I can accomplish what I'm trying to do. The Date combo box should change based on the Event but other Events that member attended should not be effected.

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

Similar Threads

  1. Formatting a date in a multi column combo box
    By Phyllis622 in forum Access
    Replies: 2
    Last Post: 04-14-2015, 01:37 PM
  2. Multi Column Combo Box on a form
    By RayMilhon in forum Forms
    Replies: 1
    Last Post: 09-20-2012, 02:59 PM
  3. Replies: 11
    Last Post: 08-22-2012, 06:34 AM
  4. Replies: 3
    Last Post: 02-22-2012, 06:05 PM
  5. Query to Limit Combo Box Choices
    By jimrockford in forum Queries
    Replies: 2
    Last Post: 04-23-2011, 10:24 PM

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