Limits

mohammadagul

PrinceAtif
Local time
Today, 21:02
Joined
Mar 14, 2004
Messages
298
ok i have a invoice form with Subform
presently i am doing somthing like this

i have placed a code on the OnEnter event of the subform as such,

If isnull (Me.CustomerId) or me.CustomerID = "" then
msgbox "Please Enter A Valid Customer ID",vbokonly,"Customer ID Needed"
me.customerID.Setfocus
End if

Now what i want is to ammend this code so that before entering inthe Invoice subform the code should check that CustoemrId, CustomerName and Employee Name is not blank. There should be some data in them. How can i make the code checks for the three textboxes instead of one.
 
If I'm understanding your question correctly...

If Nz(Me.CustomerId) = "" or Nz(Me.CustomerName) = "" or Nz(Me.EmployeeName) = "" Then...

Or are you looking for...

Code:
If Nz(Me.CustomerId) = "" then
     MsgBox "Please Enter A Valid Customer ID", vbOKOnly, "Customer ID Needed"
     Me.CustomerID.SetFocus
ElseIf Nz(Me.CustomerName) = "" then
     MsgBox "Please Enter A Valid Customer Name", vbOKOnly, "Customer Name Needed"
     Me.CustomerName.SetFocus
ElseIf Nz(Me.EmployeeName) = "" then
     MsgBox "Please Enter A Valid Employee Name", vbOKOnly, "Employee Name Needed"
     Me.EmployeeName.SetFocus
End If

You can use Nz instead of checking for both a null string and an empty string. Nz converts a null string to "".
 
Last edited:

Users who are viewing this thread

Back
Top Bottom