This would require
- Setting all but the first control to Enabled = False
- After a given control is populated, in its OnExit or AfterUpdate event, enabling the next control
- Repeating this for all control
- Doing the above in the Form_Current event as well
This approach is really ill-advised for several reasons. If there are many 'fields' you're talking about a huge amount of work
- End users each have their own approach to data entry and it seldom coincides with the developer's idea of what should be entered in what order
- If they don't have a piece of data at hand, most prefer to complete the rest of the record, retrieve the missing data, then fill in that control
- What do you do if they fill in a field, move on, filling in other fields, then come back and delete the data a previous field?
Are you beginning to get an idea of what you're talking about?
Checking for
Null (empty) controls is usually done in the
Form_BeforeUpdate, just prior to committing the data to the underlying table. Here's a simple example for two fields. It could be expanded, of course, and even coded to step thru all controls without actually naming them explicitly:
- Private Sub Form_BeforeUpdate(Cancel As Integer)
-
If IsNull(Me.Control1) Then
-
MsgBox "Control1 Must Not Be Left Blank!"
-
Cancel = True
-
Control1.SetFocus
-
Exit Sub
-
End If
-
If IsNull(Me.Control2) Then
-
MsgBox "Control2 Must Not Be Left Blank!"
-
Cancel = True
-
Control2.SetFocus
-
Exit Sub
-
End If
-
End Sub
Your thoughts?
Welcome to
Bytes!
Linq
;0)>