chakri_m16
May 8th, 2001, 11:08 PM
suppose i have three textboxes in a form and when i write this code and leave two textboxes empty it is displaying the message twice i.e. if in the form five textboxes r left empty then the message("fields should not be left empty") is displayed five times.please help me out
Public Sub CheckEmpty(frm As Form, ctl As Control)
For Each ctl In frm
If TypeOf ctl Is TextBox Then
If ctl.Text = "" Then
MsgBox " Feilds should not be empty "
ctl.SetFocus
End If
End If
Next ctl
End Sub
chakri_t@rediffmail.com
Public Sub CheckEmpty(frm As Form, ctl As Control)
For Each ctl In frm
If TypeOf ctl Is TextBox Then
If ctl.Text = "" Then
MsgBox " Feilds should not be empty "
ctl.SetFocus
End If
End If
Next ctl
End Sub
chakri_t@rediffmail.com