Results 1 to 5 of 5
  1. #1
    Jims Chan is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Mar 2016
    Location
    Malaysia
    Posts
    10

    Checkbox In MainForm to make a record in subform

    Goodday to all expert,

    I m new in access and trying to create a quotation mainform with subform.
    main have some field likes client, address, etc. Also, i would like to create 3 individual checkbox named checkbox1 represent banana, checkbox2 represent papaya & checkbox3 apple.
    If all checkbox is checked, i want the 1st line of subform item to show banana and 2nd line show papaya and so on.
    if only checkbox1 and 3 is checked, then 1st line of subform item to show banana then 2nd line show apple.



    how to do it in the simple way in vba or macro???

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Not a lot to go on, so this will be pretty general.

    I would create a sub that will set a filter on the sub form recordset - lets name the sub "SetFilterSubForm".
    In the after update event of each of the check boxes, call the sub "SetFilterSubForm".

    The code in "SetFilterSubForm" is based on the code by Allen Browne at http://allenbrowne.com/ser-62code.html.
    The description of the code is at http://allenbrowne.com/ser-62.html.

  3. #3
    Jims Chan is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Mar 2016
    Location
    Malaysia
    Posts
    10
    Click image for larger version. 

Name:	Checkbox.jpg 
Views:	14 
Size:	145.1 KB 
ID:	24268
    Still stuck in here... hehe
    in the main form have check box of motor insurance, enhanced road warrior, puspakom inspection & roadtax.
    if checkbox of motor and roadtax is checked, then 1st item in subform will be motor then follow by roadtax.
    else if 4 checkboxes are all checked, then all 4 item will be include in the subform.
    what are the way to do it?
    thanks in advance.
    Attached Thumbnails Attached Thumbnails Checkbox.jpg  

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    if checkbox of motor and roadtax is checked, then 1st item in subform will be motor then follow by roadtax.
    else if 4 checkboxes are all checked, then all 4 item will be include in the subform.
    Maybe I misread.....If you check "roadtax", do you want to only display the records in the subform that match "roadtax" or ADD a record to the subform for "roadtax"?

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by Jims Chan
    Checkbox In MainForm to make a record in subform
    Maybe I'm wrong, but I don't think the OP is talking about filtering the Subform...I think he's talking about generating Records on the Subform, dependent on what Checkboxes are ticked on the Main Form, which is kind of strange. I suspect that he should have a Combobox on the Subform to select an item for each Subform Record, instead.

    Of course, my head is still spinning trying to go from 'papaya' to 'enhanced road warrior!'

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 1
    Last Post: 03-19-2014, 10:22 PM
  2. Checkbox in mainform to control subform
    By revned12 in forum Forms
    Replies: 3
    Last Post: 09-09-2012, 02:32 AM
  3. Replies: 1
    Last Post: 06-15-2012, 05:08 AM
  4. Replies: 4
    Last Post: 03-30-2012, 01:47 AM
  5. Replies: 10
    Last Post: 12-31-2010, 12:35 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