Results 1 to 10 of 10
  1. #1
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672

    On Form Create Checboxes for Each Record In Table

    Hi - I have a main form, that I want to create a sub-form of checkboxes and names based off a query. My query contains the following fields
    Name


    SNV
    CN

    On the subform I want to display a checkbox with the text of CN - SNV (example Silacial - jm1231)

    How can I dynamically create a checkbox with the text set to a concatenation of two rows in a query?
    Last edited by jo15765; 05-31-2019 at 08:57 AM.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    You don't.
    You'd need a value field ,rows with the same number/txt value would concat .
    checks would not know.

  3. #3
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672
    Quote Originally Posted by ranman256 View Post
    You don't.
    You'd need a value field ,rows with the same number/txt value would concat .
    checks would not know.
    The same text exists in the Name field - so each row with the name of James I'd want to concatenate the values and generate the checkbox.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    If you wanted to do that you'd have to create a query to add *all* your users to every item on your main form with a yes/no field which is going to bloat your subtable pretty quickly. I'd suggest doing something like a list box with all your people in it making it a multi select list box and a single 'add' or 'remove' button to copy all of the selected people to the relevant subtable.

  5. #5
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672
    Quote Originally Posted by rpeare View Post
    If you wanted to do that you'd have to create a query to add *all* your users to every item on your main form with a yes/no field which is going to bloat your subtable pretty quickly. I'd suggest doing something like a list box with all your people in it making it a multi select list box and a single 'add' or 'remove' button to copy all of the selected people to the relevant subtable.
    I'm not sure I follow you....I have a main form that has a combo-box where the user will select the name, I will then pass that combobox value as a filter param to the sub-form so it will show all
    CN - SNV (concatenated like my example for the specified name with a checkbox.

    This is what sample table data looks like
    Name CN SNV
    James Siacial jm1231
    James Locaile jm1238
    James Meritain jm1183
    Jack Lotabale jc2832
    Jack Hilbaoa jc2882


    If the user selected James from the combo box - I would want the sub-form to show
    checkbox Siacial - jm1231
    checkbox Locile - jm1238
    checkbox Meritain - jm1183

    Is that possible?

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    how about a sample of your database, without knowing how the form and subform are connected (if at all) I can't be more specific.

    I had been assuming your form/subform were linked and related, if that's the case you'll have to re-imagine how you want this to work, if it's not I am not sure what you mean.

  7. #7
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672
    Quote Originally Posted by rpeare View Post
    how about a sample of your database, without knowing how the form and subform are connected (if at all) I can't be more specific.

    I had been assuming your form/subform were linked and related, if that's the case you'll have to re-imagine how you want this to work, if it's not I am not sure what you mean.
    Sure below is a link to sample data. I have my main form with a combo-box where the user will select a name. I then want to display a check box to allow the user to select which CN (Concatenation of CN - SNV) is needed.
    Attached Files Attached Files

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    You're doing this the hard way.

    Change your EMPLOYEES query to be:

    SELECT AllData.ID, [Name] & " " & [cvn] & " - " & [snv] AS Expr1
    FROM AllData
    GROUP BY AllData.ID, [Name] & " " & [cvn] & " - " & [snv], AllData.Name, AllData.CVN
    ORDER BY AllData.Name, AllData.CVN;

    This concatenates the names and their employee ID (presumably) so they are all visible in the same field so you can start typing JAMES and hop to all the employees who's first name starts with james and select from there.

    no reason to do what you propose.

    I would also make sure the combo box has 2 columns with widths 0,3

    This will suppress the first column but allow you to use the primary key of the employee table to drive everything else as opposed to searching on a text field that may or may not change.

    EDIT: you will also have to change the ROW SOURCE of your combo box to just be the Employees query

  9. #9
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672
    How does that allow me to select a specific CVN & SNV based off the name selected?

  10. #10
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,563
    PMFJI

    But why do you need a Subform with a Concatenation of the Name and CVN in a Subform ??

    What is the reason for this??

    You currently only have 1 table.

    Normally you would have 2 tables - 1 being the Parent of the related Child table.

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

Similar Threads

  1. Replies: 3
    Last Post: 10-26-2018, 05:16 AM
  2. Replies: 9
    Last Post: 08-19-2015, 11:29 AM
  3. Create a form from table record
    By ande8698 in forum Forms
    Replies: 1
    Last Post: 04-24-2014, 09:40 AM
  4. Replies: 3
    Last Post: 02-21-2012, 10:59 AM
  5. Create PDF for each record in table/form
    By ChrisCMU in forum Forms
    Replies: 15
    Last Post: 07-28-2009, 01:52 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