Multi field validation

teiben

Registered User.
Local time
Today, 19:04
Joined
Jun 20, 2002
Messages
462
Found some great code, else where that perhaps someone else can use.

Each required fields tag property - change to required
Dim blnContinue As Boolean
Dim ctl As Control
blnContinue = True
For Each ctl In Me.Controls
If ctl.Tag = "Required" Then
If IsNull(ctl) Then
MsgBox "Required Information Missing", vbCritical + vbOKOnly + vbDefaultButton1, "You must fill in the x xx xxx xxxx fields"
Cancel = True
ctl.SetFocus
Exit For
End If
End If
Next ctl
Set ctl = Nothing
End Sub
 
Post elsewhere

While I'm sure one of the moderators will take care of this (they're good like that) you should post things like this in the code repository so that people looking through that forum can spot it easily. :) Thanks for the code!
 

Users who are viewing this thread

Back
Top Bottom