referencing more than one cotrol

scottappleford

Registered User.
Local time
Today, 22:50
Joined
Dec 10, 2002
Messages
134
Hi
Ihave the following code

Private Sub QuauntityOut_Enter()
If IsNull(Me![EmployeeID]) Then
MsgBox "You must enter an employee and transaction type before you can book stock in or out"
Me.EmployeeID.SetFocus
End If
End Sub

I would like to add another control that If IsNull after the employeeid reference - how do i do this as i have tried but it is not working correctly?

Many Thanks

Scott
 
Try using this code in the forms Before Update event:

Code:
If Me.EmployeeID = "" Or IsNull(Me.EmployeeID) Then
      Me.EmployeeID.SetFocus
      MsgBox "Required Field", vbCritical
      Cancel = True
      Exit Sub
End If

If Me.TransactionType = "" Or IsNull(Me.TransactionType) Then
      Me.TransactionType.SetFocus
      MsgBox "Required Field", vbCritical
      Cancel = True
      Exit Sub
End If

This format will allow you to easily add more 'Required' fields if necessary
 
Last edited:

Users who are viewing this thread

Back
Top Bottom