Maximizing Connectivity & Productivity

MS Access – Validate controls on form

Use this code on the BeforeUpdate event. Name your controls so that the user will know which box they must complete.

For each ctl in frm.controls
If isnull(ctl.value) then
Msgbox “Please enter ” & ctl.Name
ctl.Name.Setfocus
Cancel=true
Exit Sub
End if
Next

If there is any control they need not complete add another If statement to exclude it.

Leave a Reply

You must be logged in to post a comment.

E-mail: info@netlogistix.com
Mississauga, ON, Canada 905.607.3500