+ Reply to Thread
Results 1 to 6 of 6

Ensure TextBoxes are Filled in VBA Forms

  1. #1
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Ensure TextBoxes are Filled in VBA Forms

    Hi all,

    This is an extension of here. What I am trying to now accomplish is making sure all fields are filled out before the form unloads. I have the following code, thanks to the mentioned link:
    Please Login or Register  to view this content.
    **Note** Yes I used a GoTo, but only to try it, I swear I didn't inhale
    At any rate, the GoTo went on a continuous loop so it was useless to me anyways. The main point is, I don't want the form to unload until all of the forms are filled. Thoughts?

    Thank you.
    Last edited by Mordred; 06-05-2011 at 09:30 PM.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Ensure TextBoxes are Filled in VBA Forms

    You could use something like

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Ensure TextBoxes are Filled in VBA Forms

    Thank you mikerickson, that was exactly what I was after.

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Ensure TextBoxes are Filled in VBA Forms

    You can't set focus on more than 1 item.
    I'd prefer not to indicate whenever a user does anything 'wrong' (the user never does), but to indicate when the user's input suffices by showing a next field or a button to continue.



  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Ensure TextBoxes are Filled in VBA Forms

    That code is not setting the focus to more than one control, just to the last one that failed the test.

    I agree, its a better user interface that prevents the user from making bad entries than one that corrects them after the fact. Nonetheless, the OP is following the many (bad) examples set by what is out there.

  6. #6
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Ensure TextBoxes are Filled in VBA Forms

    Thanks for all of the input. Your code worked like a charm mikerickson.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1