Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Easiest way to ensure text box is filled?

Easiest way to ensure text box is filled?

Easiest way to ensure text box is filled?

I have form where 7 out of 15 forms must be complete before user can save.  Do you have to prompt at each text box and if so, do you use afterupdate, beforeupdate, lostfocus or onenter?  Or, is there a way to flag all seven text boxes at one time?  My form seems to be doing this (upon trying to save, it prompts you one text box at a time) so that you may hit "Save" 7 times and each time it tells you to enter text into another empty text box.  This isn't very efficient.  Also, regardless of which  way you do this, can you throw focus back to the empty text box?  I've attempted to do it with a textboxname.setfocus command, but it doesn't work?  Any help is appreciated.

RE: Easiest way to ensure text box is filled?

In my last project I set the back color of each required field to yellow. If the user filled in the field the color changes to white. This is a good attention getter. You could also rewrite your code at the save button to build one message for all the required fields that have been missed. It looks like this.

Dim msg as string
if IsNull(yourField) then
    msg = msg & "Missing xxxxx" & vbNewLine
end if

if IsNull(nextField) then
    msg = msg & "Missing xxxxx" & vbNewLine
end if

Then display this message when the testing is done
if msg not vbNullString then
    MsgBox msg
end if

Note: Here is somthing you might like. If you don't have some type of message function, try this.

Replace the - MsgBox msg - above with - Talk msg -
Here is the Talk function, paste it into a general module
named basMessages.

Public Const conAppTitle = "Your Application Name Here"

Public Sub Talk(strMessage As String)
'Display a message to the user.
    MsgBox strMessage, vbExclamation, conAppTitle
End Sub

John A. Gilman

RE: Easiest way to ensure text box is filled?

Thank you John for responding to my plea!  I am going to try it on Monday and let you know the results.  I like the idea of color coding...get back to you soon...and THANKS!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close