Making a form field required

M

mom2three

First of all, I have a form with several fields. Several of the fields are
drop down boxes.

1. Can I make these fields required (and how do I do it)
2. If I'm already using all 25 items for the list, can I make sure none are
set as the default and/or how could I tell that they had actually made a
selection and not just accepted the default?

Thanks much
 
R

Rob

I'm assuming this is a UserForm and when you say "field" you mean text box.
You could do it several different ways. You could check the value of each
text box in an Exit event, or you could check all of the boxes when the user
clicks OK, assuming you have an OK button on the form. Pop up a message box
telling them what isn't filled out correctly and exit the sub before you do
anything. For example, put this in your OK button click. Change the names as
necessary:

If Me.TextBox1.Text = "Default" Then 'or "" for empty
MsgBox "You need to fill in textbox1"
Exit Sub
End If

Just make sure you don't hide the form before that point.

Now, if you mean form fields on a document that's altogether different. You
can do that as well but I'll wait to hear if that's what you need before
suggesting something.
 

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