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!

Text Box entry enhancements, need help

Status
Not open for further replies.

wfweirich

Programmer
Sep 10, 2001
21
0
0
US
I have just finished creating a visual basic form that allows the user to enter a lot number and number of labels to print. This process then looks for an entry in an Access table and generates the label(s). On the input screen, there are 5 fields: lot prefix(2 numeric), lot number(3 numeric), lot suffix(2 alpha), sub lot(2 numeric) and number of labels to print(up to 4 numeric). I would like to accomplish 2 things. I would like the cursor to auto advance when the input field is filled, and force upper case on the lot suffix field, making it unnecessary for the user to hold down the shift key. This seems to me like a fairly simple modification. I have searched the help text and other project examples at my disposal and now ask for your help. Thank you in advance for your help.
 
Private Sub Text1_KeyPress(KeyAscii As Integer)
'This will check the length of the string
If len(Text1.Text) = WHATEVER LENGTH YOU WANT then
Text2.Setfocus
End If
End Sub

Private Sub Text1_LostFocus()
'This will set the box to Upper Case when the user moves to a different control
Text1.text = Ucase(text1.text)
End Sub


chadt@techtnologies.com
 
You can also force Upper case in this way
Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = ASC(UCASE(chr(keyascii)))
End Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top