Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

Subform and checkbox reset

I have a checkbox on a form that when a user marks or checks, a pop-up subform is made visible.  I need to know how to code the following:
 
a)  reset the checkboxes on the main form and the subform when the user exits the particular record or go to the next record (i.e. uncheck all boxes).

Currently, I have the following code for the
Private Sub MyCheckbox_AfterUpdate()
 If Me.MyCheckbox.Value = True Then
      Me.MySubform.Visible = True
       
      End If
End Sub
0
emacyam
Asked:
emacyam
2 Solutions
 
domjCommented:
The 'on Current' event is the one that you want (Form_Current()). Set your checkboxes to False on this event and they will reset every time a new record becomes Current Record.

Dom
0
 
Mighty_SillyCommented:
The code for resetting the check box would be placed on the form's On_Current event as Dom mentioned:

 Me!MyCheckbox = false   ' This forces the chkbox to false
 Me!MySubform.Visible = false  ' This forces sub-form to be invisible

You didn't mention any other validation so the above will Blank out the check box and make subform invisible EVERYTIME you move off the current record (by going to the next record or new record.)

Hope this helps!
-Silly-
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now