Check/Uncheck boxes on subform based on main form (1 Viewer)

oxicottin

Learning by pecking away....
Local time
Today, 17:55
Joined
Jun 26, 2007
Messages
856
Hello, I have a check box on frm_Main called chkReleaseALL and when checked I want all checkboxes on my sub form to be true if it isn't already checked which that's what I got it doing with the code below BUT what if I uncheck the checkbox (chkReleaseALL) on my main form, how do I revert/undo what was checked already or uncheck on my sub form?

Code:
Private Sub chkReleaseALL_Click()

Dim rs As DAO.Recordset

Set rs = Me.sfrm_ProductHoldData.Form.RecordsetClone
  With rs
    .MoveFirst
    Do Until rs.EOF
    .Edit
    .Fields("ReleaseSingleEntry") = True
    .Update
    .MoveNext
 Loop
 End With
Set rs = Nothing
      
End Sub
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:55
Joined
Aug 30, 2003
Messages
36,134
How about

.Fields("ReleaseSingleEntry") = Me.chkReleaseALL
 

plog

Banishment Pending
Local time
Today, 16:55
Joined
May 11, 2011
Messages
11,670
revert/undo what was checked already or uncheck on my sub form?

You don't.

Let's see if I understand the general concept.----You have 3 check boxes in the subform, 2 of which are checked (true), 1 unchecked (false). You click chkReleaseAll and all of those 3 check boxes become True. Now you want to uncheck chkReleaseAll and have the 2 previously true check boxes remain true and have that 3rd one return to false? Out of luck.

If you truly want that functionality you have 2 options--build a table to hold the history of those check boxes and their changes or assign global variables to the form so the form itself can remember each check boxes prior state. The table option is more permanent--you could close down Access, come back 3 days and return those checkboxes to their prior state. The form method is more temporary--it will only remember the prior state while that form is open.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 22:55
Joined
Feb 19, 2013
Messages
16,683
how do I revert/undo what was checked already or uncheck on my sub form?
just a guess as the scenario provided is probably too simplistic but perhaps

.Fields("ReleaseSingleEntry") = .Fields("ReleaseSingleEntry").oldvalue

or perhaps as plog infers have an array or collection populated with the old values

or use an ADO disconnected recordset for the subform
 

oxicottin

Learning by pecking away....
Local time
Today, 17:55
Joined
Jun 26, 2007
Messages
856
You don't.

Let's see if I understand the general concept.----You have 3 check boxes in the subform, 2 of which are checked (true), 1 unchecked (false). You click chkReleaseAll and all of those 3 check boxes become True. Now you want to uncheck chkReleaseAll and have the 2 previously true check boxes remain true and have that 3rd one return to false? Out of luck.

If you truly want that functionality you have 2 options--build a table to hold the history of those check boxes and their changes or assign global variables to the form so the form itself can remember each check boxes prior state. The table option is more permanent--you could close down Access, come back 3 days and return those checkboxes to their prior state. The form method is more temporary--it will only remember the prior state while that form is open.
You are correct thats what i wanted to do.... Ill look into how i can do your solution thank you!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 14:55
Joined
Aug 30, 2003
Messages
36,134
Sorry, I missed the big picture.
 

Users who are viewing this thread

Top Bottom