Does anyone know how to insert a warning message (make a warning message dialog box displays also) so the user can be aware when he/she selects “CLOSED” from the Status combo box that the form will not be editable once the current is saved/close or if there is a new record is added? (I would like to have a YES and NO button on the dialog box also.)
The warning message should be like this:
This form will not be editable after you save, close or add a new record. Do you want to continue?
Thank you for your help!
Below are the VBA codes I have used. If you have any other codes better than mine, please feel free to let me know. Thanks
Expand|Select|Wrap|Line Numbers
- Private Sub Form_AfterUpdate()
- If Me![STATUS] = "CLOSED" Then
- Me.AllowEdits = False
- Else
- Me.AllowEdits = True
- End If
- End Sub
- Private Sub Form_Current()
- If Me![STATUS] = "CLOSED" Then
- Me.AllowEdits = False
- Else
- Me.AllowEdits = True
- End If
- End Sub