Loop through Textbox controls

G

Guest

Hi,

I would like to make sure that all textbox controls have a value entered. I
have part of the code but don't quite know how to check for null or empty
string using the control type. Also, I have one which contains a date and
one that will only be enabled or unlocked if the records is of a certain
category (not sure how this would affect it).

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If ctl Is Null Then 'this is where I'm stuck
MsgBox "All fields are required.", vbOKOnly + vbExclamation, "Error"
Exit Sub
End If
End If
Next

Thanks for the help
LeAnn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top