Results 1 to 14 of 14
  1. #1
    mib1019 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2020
    Posts
    54

    Use multi-select combo box values to fill date values in textbox control

    Help please.



    Form field txtStartDate: User chooses a date from combo which is always a Monday.
    Form field cboAirDay(s): User chooses one or multiple days of week from drop down multi-select). Bound column holds day number value 0-7 (Sun-Sat).
    Form field txtAirDates: Display only - dates in mm/dd format, of dates for the days user picked in cboAirDays.

    So if the StartDate picked is 06/01/20 and the user has selected Tue and Thu in cboAirDay(s), then txtAirDates should display "06/02, 06,04".

    Thanks in advance for your suggestions!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    A multi-select combobox must be bound to a multi-value field. Advise not to use multi-value fields.

    Also advise not to save CSV into a regular text field.

    This is all poor db design.

    A multi-select listbox does not have to be bound to a field.

    No matter which way you go, will need VBA code.
    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
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    some issues with your explanation which need clarifying

    Bound column holds day number value 0-7 (Sun-Sat).


    that is 8 days - do you mean 0-6?

    StartDate picked is 06/01/20
    dates come in many formats - is that 6th January or 1st June? (both are mondays). Sounds like the latter, but what would you want to appear if user chooses a day which is not a monday?

    If the user chooses 8th June, with Tuesday and Thursday do you expect to see the same result per your example?

    or the user selects an airday of 0 (for Sunday)

    what if the user selects 1 or 3 or more airdays?

    what is the significance of the first value being shown as 06/02 and the second as 06,04?

    would help if you can clarify what you are trying to do - in simple English





  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    It would really help if you would post your dB.

    One problem is that a combo box does not have a multi-select property. Only a List box has the multi-select property.

    After (if) you are able to select multiple days, you want to results to be put in one text box control?


    I really think this is a bad design, but maybe this will help you move forward.
    Attached Files Attached Files

  5. #5
    mib1019 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2020
    Posts
    54
    Need to correct a couple of things from my original question. The field for the user to pick days is a multiselect, in table design, with two columns 1-DayNum (1-7, Mon-Sun ). The combo box on the form displays second column Mon-Sun and checkboxes. If user chooses Tue and Thu, the textbox would display Tue, Thu. The table holds the values 2, 4.

    Doesn't matter how many days of the week the user chooses. There is another field which counts the number of days selected and uses that in a formula. It works correctly.

    I just want the user to see the dates for the days selected for that week which begins with the StartDate, which is always a Monday, and is in an earlier field on the form.

    It was a typo on my part, the 06,04. For the sake of space, I'd like to use just m/d. So if the user chooses Tue and Thu in the week beginning 6/1/20, the text box would display "6/2, 6/4". If he selected Mon, Wed and Fri in the multiselect, the text box would display "6/1, 6/3, 6/5".

    Thanks so very much for your help!

  6. #6
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    you are not answering all the questions

    So if the user chooses Tue and Thu in the week beginning 6/1/20, the text box would display "6/2, 6/4".
    and if the monday chosen is 6/8/20 - they would also see "6/2, 6/4"?

    and what would they see if they chose 6/29/20?

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    @mib1019, None of that is new info for me - I fully understood requirement - and does not alter advice already given. This is poor design and will drive you down road of insanity.

    The code required in outline:

    1. commit record with multi-value field inputs to table

    2. open recordset of multi-value field data

    3. loop through recordset and build CSV string

    4. either save CSV string to table (bad idea) or just display in unbound textbox

    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.

  8. #8
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    One problem is that a combo box does not have a multi-select property
    Pretty sure a combo box bound to a multi value field is multi select(able). Not that I would know from experience.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #9
    mib1019 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2020
    Posts
    54
    ssanfu, thank you very much. This is all I needed!

    mib1019

  10. #10
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by Micron View Post
    Pretty sure a combo box bound to a multi value field is multi select(able). Not that I would know from experience.
    OK, here is my reasoning.

    Create a form and add a list box and a combo box. Open the properties dialog box.
    On the Other tab:
    A list box has a Multi Select property.
    A combo box does not have a Multi Select property.

    Now, just because you can set the control source of a combo box to a multi value FIELD does not make the combo box have a Multi Select property in the sense of a list box Multi Select property. (IMHO)
    The combo box would just be an extremely poor implementation of a main form/sub form design.








    Hmmmm, I wonder what would happen if you set the control source of a list box to a multi value FIELD and set the list box Multi Select property to Simple/Extended...
    Oh well, I have not and do not use multi value FIELDS, so I guess that question will remain unanswered (at least by me)


    (BTW, this is Root Beer!!!)


    ---------------------------------------------
    Edit: changed the purple terms from "Select" to "Value". I used the wrong terms when referring to Multi value fields (as in The evils of lookup fields )

  11. #11
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Now, just because you can set the control source of a combo box to a multi-select(able) FIELD does not make the combo box have a Multi Select property
    what is this then??

    Click image for larger version. 

Name:	mvCombo.jpg 
Views:	15 
Size:	94.2 KB 
ID:	42047
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  12. #12
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Oops, instead of multi-select(able) FIELD, I should have said "Multi VALUE Field" (MVF) in my previous post.

    I edited my previous post....

    If you add an unbound combo box and an unbound list box to a form and the Row Source of each is a Value List, can you set the combo box to mimic the list box when the list box Multi Select property is set to Simple/Extended??
    Can you select 3 values in the list box, then select the same 3 values in the combo box??

    Ack!!! You're making my brain hurt!

  13. #13
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I think the answer to that is in the first sentence of post 2 - which I agree with since now you're asking about a combo
    an unbound combo box ... to a form and the Row Source (of each) is a Value List, can you set the combo box to mimic the list box
    whereas before, you were asking about a listbox:
    I wonder what would happen if you set the control source of a list box to a multi value FIELD and set the list box Multi Select property to Simple/Extended...
    Or am I the one who's confused now? No matter, I think we're on the same page if not the same paragraph.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  14. #14
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Hopefully in the same book!!??

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

Similar Threads

  1. Replies: 6
    Last Post: 05-28-2020, 11:44 AM
  2. Get Values From Multi Select List Box
    By Juan4412 in forum Programming
    Replies: 4
    Last Post: 03-21-2017, 02:26 PM
  3. Combo Box Value returns Multi Values
    By huskersippi in forum Forms
    Replies: 1
    Last Post: 11-01-2016, 01:39 PM
  4. Replies: 11
    Last Post: 08-04-2016, 09:56 AM
  5. Delete values in a multi-columned combo box
    By enquiries in forum Programming
    Replies: 8
    Last Post: 04-10-2014, 02:17 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