Reset Form to show default values

D

dwaynesworld

I tried to find a solution to this in the previous threads but was unable to.
I have a form with many areas that are to be filled. I also have a check
box which will hide/disable many of the forms when checked. After a user
completes the form with the checkbox set to true and they elect to enter a
new record, the checkbox value is false but the disabled sections on the form
are still disabled. I have to check then uncheck the box to activate the
disabled sections. Is there a way to have access automatically reset the
disabled sections to be enabled once we add a new record? I have attached
some code below to help:

********************************************************
This code is for the checkbox

Private Sub Prep_Wrap_Hours_Only_AfterUpdate()
If [Prep/Wrap Hours Only].Value = True Then
[Team Asst].Enabled = False
[Counselor].Enabled = False
[Processor].Enabled = False
[Underwriter].Enabled = False
[Closer].Enabled = False
[Other].Enabled = False
[OPM].Enabled = False
[RSM].Enabled = False
[AOM].Enabled = False
[BM].Enabled = False
[PM].Enabled = False
[BQ].Enabled = False
[ISD].Enabled = False
[QC].Enabled = False
[DIST].Enabled = False
[NSD].Enabled = False
[OD].Enabled = False
[CS].Enabled = False
[qrpAudience].Enabled = False
[chkCo-Facilitator].Enabled = False
[Other Comments].Enabled = False
[txtFacilitatorHours].Enabled = False
[txtTotalParticipants].Enabled = False
[grpFacilitatorType].Enabled = False
[Delivery Method].Enabled = False
[eLearning Hours].Enabled = False
[eLearning Hours].Value = 0
Else
[Team Asst].Enabled = True
[Counselor].Enabled = True
[Processor].Enabled = True
[Underwriter].Enabled = True
[Closer].Enabled = True
[Other].Enabled = True
[OPM].Enabled = True
[RSM].Enabled = True
[AOM].Enabled = True
[BM].Enabled = True
[PM].Enabled = True
[BQ].Enabled = True
[ISD].Enabled = True
[QC].Enabled = True
[DIST].Enabled = True
[NSD].Enabled = True
[OD].Enabled = True
[CS].Enabled = True
[qrpAudience].Enabled = True
[chkCo-Facilitator].Enabled = True
[Other Comments].Enabled = True
[txtFacilitatorHours].Enabled = True
[txtTotalParticipants].Enabled = True
[grpFacilitatorType].Enabled = True
[Delivery Method].Enabled = True
[eLearning Hours].Enabled = True
End If

End Sub
*****************************************************
This code is for the command button to add a new record

Private Sub cmdNewCourse_Click()
On Error GoTo Err_cmdNewCourse_Click


DoCmd.GoToRecord , , acNewRec
Me.Instructor.SetFocus

Exit_cmdNewCourse_Click:
Exit Sub

Err_cmdNewCourse_Click:
MsgBox Err.Description
Resume Exit_cmdNewCourse_Click

End Sub

Thanks!!!!!
 
J

Jeff Boyce

What code causes the checkbox's AfterUpdate code to (re-)run? That is, how
does it know it is supposed to reset the enabled properties?

Regards

Jeff Boyce
Microsoft Office/Access MVP

dwaynesworld said:
I tried to find a solution to this in the previous threads but was unable
to.
I have a form with many areas that are to be filled. I also have a check
box which will hide/disable many of the forms when checked. After a user
completes the form with the checkbox set to true and they elect to enter a
new record, the checkbox value is false but the disabled sections on the
form
are still disabled. I have to check then uncheck the box to activate the
disabled sections. Is there a way to have access automatically reset the
disabled sections to be enabled once we add a new record? I have attached
some code below to help:

********************************************************
This code is for the checkbox

Private Sub Prep_Wrap_Hours_Only_AfterUpdate()
If [Prep/Wrap Hours Only].Value = True Then
[Team Asst].Enabled = False
[Counselor].Enabled = False
[Processor].Enabled = False
[Underwriter].Enabled = False
[Closer].Enabled = False
[Other].Enabled = False
[OPM].Enabled = False
[RSM].Enabled = False
[AOM].Enabled = False
[BM].Enabled = False
[PM].Enabled = False
[BQ].Enabled = False
[ISD].Enabled = False
[QC].Enabled = False
[DIST].Enabled = False
[NSD].Enabled = False
[OD].Enabled = False
[CS].Enabled = False
[qrpAudience].Enabled = False
[chkCo-Facilitator].Enabled = False
[Other Comments].Enabled = False
[txtFacilitatorHours].Enabled = False
[txtTotalParticipants].Enabled = False
[grpFacilitatorType].Enabled = False
[Delivery Method].Enabled = False
[eLearning Hours].Enabled = False
[eLearning Hours].Value = 0
Else
[Team Asst].Enabled = True
[Counselor].Enabled = True
[Processor].Enabled = True
[Underwriter].Enabled = True
[Closer].Enabled = True
[Other].Enabled = True
[OPM].Enabled = True
[RSM].Enabled = True
[AOM].Enabled = True
[BM].Enabled = True
[PM].Enabled = True
[BQ].Enabled = True
[ISD].Enabled = True
[QC].Enabled = True
[DIST].Enabled = True
[NSD].Enabled = True
[OD].Enabled = True
[CS].Enabled = True
[qrpAudience].Enabled = True
[chkCo-Facilitator].Enabled = True
[Other Comments].Enabled = True
[txtFacilitatorHours].Enabled = True
[txtTotalParticipants].Enabled = True
[grpFacilitatorType].Enabled = True
[Delivery Method].Enabled = True
[eLearning Hours].Enabled = True
End If

End Sub
*****************************************************
This code is for the command button to add a new record

Private Sub cmdNewCourse_Click()
On Error GoTo Err_cmdNewCourse_Click


DoCmd.GoToRecord , , acNewRec
Me.Instructor.SetFocus

Exit_cmdNewCourse_Click:
Exit Sub

Err_cmdNewCourse_Click:
MsgBox Err.Description
Resume Exit_cmdNewCourse_Click

End Sub

Thanks!!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top