Force user to enter value into text box

scheeps

Registered User.
Local time
Tomorrow, 12:17
Joined
Mar 10, 2011
Messages
82
My records are displayed in a datasheet view. If the user updates the Status combo box to a specific value, he needs to add in text in the Notes fields before moving onto the next record.

I've got the following code in the form's Before Update event:

Code:
If (Me.NewRecord) Then
        Exit Sub
    ElseIf Nz(Me.cboDataStatus.OldValue, "") <> Nz(Me.cboDataStatus, "") And (IsNull(Me.Creation_Notes) Or Me.Creation_Notes = "") Then
         MsgBox "Please enter a reason in the note field for why this record's status has been updated.", vbInformation, "Creation Note"
         Me.Creation_Notes.SetFocus
   End If

And in the Notes field's Lost Focus event:
Code:
If IsNull(Trim(Me.Creation_Notes)) Or Trim(Me.Creation_Notes) = "" Then
        MsgBox "Please ensure the necessary text has been entered into the Notes field.", vbOKOnly, "Please enter a note"
        Me.Creation_Notes.SetFocus
    End If

But this still allows the user to move the focus to the next record. I would like to force him/her to enter text in the notes field if the status has been updated, no matter what.

How can I achieve this?
 
Awesome Paul, I love simple answers.

Thanks, it works perfectly!
 

Users who are viewing this thread

Back
Top Bottom