Required Field Validation

PRodgers4284

Registered User.
Local time
Today, 21:17
Joined
Feb 17, 2009
Messages
64
I have a form that has various fields with the field property required set to yes, i want to add validation that validates if a required field is equal to null for example

If IsNull(.Required) then
MsgBox "Required fields incomplete"
End If

I want one msg to check all the fields set to required instead of writing validation for each form input field. Any help is much appreciated.
 
You can start here because the IsNull isn't a complete method of validation.

And to loop through controls, there is some help here.

If you cobble both ideas together you can get what you want.

Also, if you make use of the ctl.Name and ctl.SetFocus methods, you can call the user attention to the specific control in question.

-dK
 
You can start here because the IsNull isn't a complete method of validation.

And to loop through controls, there is some help here.

If you cobble both ideas together you can get what you want.

Also, if you make use of the ctl.Name and ctl.SetFocus methods, you can call the user attention to the specific control in question.

-dK

Hey thanks for your help, im using the following code for a textbox called "PatientID" and it works fine, just wondering if i could add another textbox to the if statement for example "IF PatientID or Surname etc is equal to 0 then error message"

If Len(Nz(Me!PatientID, "")) = 0 Then
MsgBox "You must enter the something.", , "The Something"
Me!PatientID.SetFocus
 

Users who are viewing this thread

Back
Top Bottom