Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

I'm trying to validate all text boxes in my form if there are blanks. but i'm getting "Method or Data Member not Found" Error

Here is the code:


Dim ctl As Control

For Each ctl In Me.Controls'
If TypeName(ctl) = "TextBox" Then
If ctl.Value = "" Then
msg = MsgBox("All Fields Required", vbExclamation + vbOKOnly + vbApplicationModal, "Warning")
Exit Sub
End If
End If
Next ctl

The <Me.Controls> on my first line gets highlighted with error.
not not sure if i had missed to add a reference like ActiveX Control under Tools > References.

thanks in advance.
Posted

I think you want to iterate through the controls on a Sheet.

So, your your answer is here[^].
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900