Results 1 to 6 of 6
  1. #1
    Shamli is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2018
    Location
    California
    Posts
    142

    Listbox with check boxes and saving the selection

    Hi
    I want a list box with many columns and upon selection the data has to be stored on the table using a append query.

    Explanation:


    I have list box which takes the data from "Project table" with columns : Element, Project name ElementId, ProjectID etc.
    1. I wanted to have a checkbox in the list box . so that the user can select multiple items. I have tried "Simple" in multiselect option. I feel like its not user friendly. (selection doesn't go off after refreshing etc.)
    2. Upon selection through check box, it has to saved in another table (Emp to project) with all the columns respectively.

    I am not sure how to proceed with it. Please help in solving this problem.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    This is not possible with listbox control. A combobox bound to a multi-value field will have checkbox. However, I do not recommend multi-value field.

    A listbox does have multi-select capability, just cannot have checkbox in it.
    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
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    This may help with the saving part. I also don't think you can have a checkbox in a listbox.

    http://www.baldyweb.com/MultiselectAppend.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Shamli is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2018
    Location
    California
    Posts
    142
    Thanks. But my list box has many columns, upon selection the values should append to the table. (with the respective fields)
    How to apply that?
    Quote Originally Posted by pbaldy View Post
    This may help with the saving part. I also don't think you can have a checkbox in a listbox.

    http://www.baldyweb.com/MultiselectAppend.htm

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    ctl.Column(x, varItem)

    where x is the zero-based number of the desired column. In most cases you'd only save a key value from a related table though.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Options to save multiple records:

    1. execute an SQL INSERT action inside loop that reads each selected item

    2. open recordset object then inside loop add new record and after looping completes update the recordset
    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.

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

Similar Threads

  1. Replies: 8
    Last Post: 02-15-2018, 11:06 AM
  2. Replies: 3
    Last Post: 08-01-2017, 04:02 PM
  3. Replies: 5
    Last Post: 05-03-2016, 04:23 PM
  4. Replies: 2
    Last Post: 05-29-2014, 09:58 PM
  5. Check Boxes saving log in data?
    By Z1nkstar in forum Access
    Replies: 1
    Last Post: 03-20-2014, 01:29 PM

Tags for this Thread

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