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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password input mask, error in function

Status
Not open for further replies.

striker73

MIS
Jun 7, 2001
376
US
I have a function that checks the length of a string entered in a textbox. It checks to see if it is within the max field length and if not, alerts the user. I have a password field where I want to be able to limit the number of characters entered. My code is in the LostFocus() portion of the textbox:

If (Len(SendingForm.Controls(TextBoxName).Text) > maxfieldlength) Then

Sometimes Access gives me a "Microsoft Access cannot retrieve the value of this property" error. I have tried removing the .Text portion, but then it doesn't give me the right number. Is there any way around this? The textbox has the password input mask on it.
 
Hi!

Use this code in the change event of the text box:

If (Len(Me!TextBoxName.Text) > maxfieldlength) Then
Me!TextBoxName.Text = Left(Me!TextBoxName.Text, maxfieldlength)
Call MsgBox("You exceded the maximum length. Please use a password no more than " & maxfieldlength & " characters long. The first " & maxfieldlength & " you typed have been retained.")
End If

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top