Resetting disabled criteria after record submission.

Pis7ftw

Registered User.
Local time
Today, 15:17
Joined
Aug 5, 2012
Messages
37
Hello all.

Here's the layout:

Criteria 1: Yes/No/Not Applicable - Enabled
Criteria 2: TextBox - Disabled unless Criteria 1 = "No"

Code:

Code:
Private Sub Pain_Elap_AfterUpdate()
If Me.Pain_Elap.Text = "No" And Len(Me.Pain_ElapMin & "") = 0 Then
MsgBox "Enter total time elapsed if pain is not addressed within 10 minutes of initial assessment."
If Len(Me.Pain_ElapMin & "") = 0 Then
Me.Pain_ElapMin.Enabled = True
Me.Pain_ElapMin.SetFocus
Me.Pain_ElapMin.ForeColor = vbRed
Me.Label91.ForeColor = vbRed
Else
If Me.Pain_Elap.Text <> "No" And Len(Me.Pain_ElapMin & "") = 0 Then
Me.Pain_ElapMin.Enabled = False
Me.Pain_Remark.SetFocus
End If
End If
End If
End Sub
After completion: Hit button - add new record, form goes blank.

Issue: Pain_ElapMin remains enabled and Label91 remains vbRed.

The second part of the code is obviously not working and I'm not sure why (I'm an amateur so be nice!) I would like the fields to become disabled until Criteria 1 is met again.

Thanks!
 
Great! Thanks! Um. Where is the forms current event?
 
Great! Thanks! Um. Where is the forms current event?
Open the form in design view. Go to the properties dialog and click on the EVENTS tab. It is listed there (as CURRENT) and then select [EVENT PROCEDURE] from the drop down there and then click on the Ellipsis (...) that appears to the right and it will take you to the event in the VBA Window.
 

Users who are viewing this thread

Back
Top Bottom