Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2007

Tip: Looking for answers? Try searching our database.

Making a form field required

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mom2three - 09 Feb 2007 20:10 GMT
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
Rob - 12 Feb 2007 18:38 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.