Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easiest way to ensure text box is filled?

Status
Not open for further replies.

TLefkowich

Programmer
Aug 25, 2000
4
0
0
US
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.

 
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

[sig]<p>John A. Gilman<br><a href=mailto:gms@uslink.net>gms@uslink.net</a><br>[/sig]
 
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!
Tracy [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top