Results 1 to 4 of 4
  1. #1
    Vethra is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    10

    Concatenate multiple check boxes into textbox with commas/ands

    Hi all,



    I have 20 checkboxes and would like the checked to appear into a textbox like so: Adaptor, Welding Flange, Pipe and Hanger.


    I have put this in my control source but it doesn't work the way I want it too.
    =IIf([Checkbox1],"Adaptor") & IIf([Checkbox2],", Welding Flange") & IIf([Checkbox3],", Pipe")& IIf([Checkbox4],"and Hanger") and so on..........

    Currently if checkbox1 is clear the text box will appear like so: ", Welding Flange, Pipe and Hanger" with a unwanted comma. Also I would like the last item in my text box to appear like so: "and Hanger"

    Does anyone know of any VB or anything that might help?

    Thank you,
    Dilan

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You will have to create a sub to create the string. I would use an array and loop through the check boxes. Then replace the last comma with "and".
    Kind of like creating a filter on the fly.




    Edit.... I created an example

  3. #3
    Vethra is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    10
    That is exactly what I was looking for thank you very much ssanfu

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You're welcome.
    All you should have to do is add the names to the array. and the names must be in the same order as the check boxes.

    Good luck with your project.


    Ready to mark this solved??

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

Similar Threads

  1. Replies: 1
    Last Post: 04-27-2015, 10:53 AM
  2. Deselect Multiple yes/no check boxes
    By OCStan in forum Access
    Replies: 3
    Last Post: 09-09-2013, 01:05 PM
  3. Filter Form with Multiple Check Boxes
    By Njliven in forum Forms
    Replies: 8
    Last Post: 01-09-2013, 01:50 PM
  4. Simple Query for multiple ands
    By Lorlai in forum Queries
    Replies: 8
    Last Post: 05-10-2012, 11:18 AM
  5. How do I add multiple table entries using check boxes?
    By avarusbrightfyre in forum Access
    Replies: 3
    Last Post: 10-21-2010, 01:09 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