Let me outline how to do this in an Event Procedure. I do not use macros
enough to advise you how to accomplish this with a macro. It sounds as if
you knoiw something about Event Procedures, but since I don't know what you
know I will start from scratch.
In form design view, click the control to select it, then click View >>
Properties (or whatever method you use to view the Property Sheet). Click
the Event tab, then click in the Before Update line. Click the three dots
at the right side of the line, click Code Builder, OK.
This should open the VBA editor, with something like the following:
Private Sub ControlName_BeforeUpdate(Cancel As Integer)
End Sub
The cursor should be blinking between those lines. At the cursor:
If Me.ControlName <6294350 Or _
Me.ControlName >6296000 Then
MsgBox "Out of range"
Me.ControlName.Undo
Cancel = True
End If
Use the actual control name in place of ControlName. Note that the
underscore is an optional line continuation character. You can leave it
out, and have this instead:
If Me.ControlName <6294350 Or Me.ControlName >6296000 Then
This code will have no effect if the user ignores the text box. Same for a
macro that runs when the user tries to leave the text box. The form has a
Before Update event that can be used to validate data. To see the form's
Property Sheet, if the Property Sheet is already open just click the small
square just to the left of the horizontal ruler; otherwise click that square
and open the property sheet as before.
In the form's Before Update event:
If IsNull(Me.Control_1) Then
MsgBox "Control_1 needs a value"
Me.Control_1.SetFocus
Cancel = True
ElseIf IsNull(Me.Control_2) Then
MsgBox "Control_2 needs a value"
Me.Control_2.SetFocus
Cancel = True
ElseIf IsNull(Me.Control_3) Then
MsgBox "Control_3 needs a value"
Me.Control_3.SetFocus
Cancel = True
End If
This is the general idea. It can be streamlined when you become a little
more comfortable with VBA.