Results 1 to 6 of 6
  1. #1
    MSVille is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2022
    Posts
    3

    Filtering with checkboxes in a form

    Hi!



    I've been trying to find a solution to my problem from several forums with no luck, so I decided to post my first thread/question...

    I have database of personnel with different qualifications, let's call them Qualification A through G. My Table has the name of the person in the first column and title, contact details etc. in the following 4 columns. In columns 6-12 I have the titles of Qualification A through G with Yes/No as a row value.

    I have a form with 7 checkboxes with titles Qualification A through G. There is also a listbox in the form. What I need is for the listbox to show only personnel that has "Yes" in the qualification selected in the checkboxes not considering which value the other qualifications have.
    Eg. I check Qualification A, Qualification D, Qualification E and the list box will show me 5 names out of 50 names in the table, let's call them Mary, Ann, Jeff, Rick and Susan. They all have at least the qualification A/D/E. Mary also has B and Jeff has C qualification, so If I would also now check B qualification checkbox, only Mary would be in the listbox. If I would check both B and C checkboxes, the listbox would be empty because no-one has A/B/C/D/E qualification. Unchecking checkbox A and B (now C/D/E enabled), the listbox would show only Jeff's name from the previous 5 (being the only one with C qualification) and adding from the table everyone from the remaining 45 people with C/D/E qualifications.

    Hope this makes sense of what I am trying to achieve. I would love to use checkboxes to select the qualifications needed, but if this is not possible, also multiselect listbox with the qualifications would be acceptable...

    Thanks for your consideration and support!!!

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Unfortunately your table design is wrong for a database to work correctly.
    You need two tables or possibly three tables tbPerson , tbQualifications, tbPersonQualifications.

    Each will have a unique ID PersonID, QualificationID, PersonQualificationsID.

    tbPersonelQualifications would record the Qualification ID and PersonID.

    This way when you add Qualification number 8 or 9 or 23 you don't need to redesign your forms and tables, you just add data.
    Your multiselect list box is then driven by a table not a field.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    MSVille is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2022
    Posts
    3
    Quote Originally Posted by Minty View Post
    Unfortunately your table design is wrong for a database to work correctly.
    You need two tables or possibly three tables tbPerson , tbQualifications, tbPersonQualifications.

    Each will have a unique ID PersonID, QualificationID, PersonQualificationsID.

    tbPersonelQualifications would record the Qualification ID and PersonID.

    This way when you add Qualification number 8 or 9 or 23 you don't need to redesign your forms and tables, you just add data.
    Your multiselect list box is then driven by a table not a field.
    Thanks for the reply! I will look into this database issue, but I am not really worried about adding qualifications at this point. Is this configuration necessary to enable what I am trying to do with the filtering?

  4. #4
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Without a proper normalised data structure anything you try and do with a database will become very tortuous.
    Effectively you will be "Band Aiding" any solutions and forms to accommodate a poor data design, and eventually you will come up against something that will be virtually impossible to "Work around" (e.g. bodge)

    I would recommend getting your tables correct first then look at building forms and processes around that.

    You have committed what is sometime referred to as "Spreadsheetitis", that is to say simply moved a spreadsheet list into a table.
    I guarantee you will regret not getting your tables right at the outset.

    Google Normalisation and look here http://www.rogersaccesslibrary.com/f...7eec5982638889
    Read through the examples and spend a few hours doing the lessons/reading the course notes.
    It will save you hours of frustration.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    MSVille is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2022
    Posts
    3
    Thanks! I will take your advice and restructure my database. But I still need help with the original problem. Let’s say I know have the 3 tables you suggested in your first reply, what’s next?

  6. #6
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    As basic description I would have a multiselect listbox with your qualifications listed.
    After selecting the qualifications, a command button would then run some code to populate another list box or continuous form to list the people with the selected qualifications.

    This will be quite simple to implement.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

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

Similar Threads

  1. Clear all checkboxes on form
    By Tommo in forum Modules
    Replies: 6
    Last Post: 10-08-2015, 03:04 PM
  2. Replies: 9
    Last Post: 04-26-2014, 07:10 PM
  3. Replies: 1
    Last Post: 07-31-2013, 06:31 PM
  4. Filtering a report from multiple checkboxes
    By sabre1 in forum Reports
    Replies: 2
    Last Post: 01-17-2011, 03:37 PM
  5. Disable Checkboxes for a row in Form
    By seshan in forum Programming
    Replies: 1
    Last Post: 02-05-2010, 07:36 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