[AccessD] Only allow 3 digits in a textbox

Joe Rojas JRojas at tnco-inc.com
Fri Feb 14 13:34:00 CST 2003


Thanks David,

	This does in fact work out beautifully, but what I don't want are
the underscores that work as placeholders. I hate to be persnickety, but is
there a way to just have blank spaces instead of a placeholder?

Thanks,
Joe Rojas


-----Original Message-----
From: David McAfee [mailto:DMcAfee at haascnc.com]
Sent: Friday, February 14, 2003 2:08 PM
To: 'accessd at databaseadvisors.com'
Cc: 'jrojas at tnco-inc.com'
Subject: RE: [AccessD] Only allow 3 digits in a textbox

Joe, no code required. Just set the input mask to 000, this will only allow
3 numbers in the field. For more help, press F1 in the input mask field.

David McAfee

-----Original Message-----
From:  Joe Rojas
Sent: Friday, February 14, 2003 10:41 AM
To: 'accessd at databaseadvisors.com'
Subject: [AccessD] Only allow 3 digits in a textbox


Hi All,

A2K - unbound form

I am trying to create a textbox that only allows whole numbers AND only
allows three digits.

I am working with the KeyPress event of this textbox.

What I have so far only allows digits to be entered, but I can't determine
the length of the textbox. If I use Me.textbox or Me.txtbox.Text or
Me.txtbox.Value it returns Null regardless of the actual contents of the
textbox.

Here is what I have so far:


Private Sub txtNumOfOccurr_KeyPress(KeyAscii As Integer)

If (IsNull(Me.txtNumOfOccurr)) Or (Not (Len(Me.txtNumOfOccurr) = 3)) Then
                If Not (IsNumeric(Chr(KeyAscii))) And (KeyAscii <> 8) Then
                                KeyAscii = 0
                End If
Else
                KeyAscii = 0
End If

End Sub

Any ideas?

Thanks,

Joe Rojas
jrojas at tnco-inc.com



This electronic transmission is strictly confidential to TNCO, Inc. and
intended solely for the addressee. It may contain information which is
covered by legal, professional, or other privileges. If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy, or take any action in reliance on this
transmission. If you have received this transmission in error, please notify
the sender as soon as possible and destroy this message. While TNCO, Inc.
uses virus protection, the recipient should check this email and any
attachments for the presence of viruses. TNCO, Inc. accepts no liability for
any damage caused by any virus transmitted by this email.



More information about the AccessD mailing list