I have a user form with a number of text boxes that are mandatory and have come up with some code that I thought was a neat way of checking these mandatory boxes for a value before the user form is advanced to the next record - but I gey a type mismatch error and cannot understand why - any one help me?:
Mandatory text boxes are txtTot, txtAddress1, txtCon etc
Mandatory text boxes are txtTot, txtAddress1, txtCon etc
Code:
Private Function CheckComplete()
Dim cCont As Control
For Each cCont In Me.Controls
If cCont.Name = "txtTot" Or "txtAddress1" Or "txtCon" Then
If cCont.Value = "" Then MsgBox "You need to fill in " & cCont.Name
End If
Next cCont
End Function