If you were talking about a single Required Field, it would be simple! But since you have multiple required Fields, you'd have to not only check that the current Control is populated, in its AfterUpdate event, but that all other required ones are populated, before Enabling the Command Button. Also, the users would not have any indication of which Controls were required...if they knew this, they'd have filled them in!
Probably much better would be checking all of the Required Fields/Controls at one site, the OnClick event for the Command Button, and telling the users why the print button isn't working.
In Form Design View
- Hold down <Shift> and Left-Click all Required Controls
- Go to Properties – Other
- In the Tag Property enter ReqField
Now, in the Form's Code Module
Code:
Private Sub cmdPrintButtonName_Click()
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "ReqField" Then
If IsNull(ctl) Then
MsgBox "Following Field is Required: " & vbCrLf & vbCrLf & ctl.Name
Exit Sub
End If
End If
Next ctl
'Code to Print goes here
End Sub
Hopefully, after getting the Messages telling them why the print button isn't working, they'll learn which ones are required!
Linq ;0)>
The problem with making anything foolproof...is that fools are so darn ingenious!
All posts/responses based on Access 2003/2007