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

Input mask in VBA?

Status
Not open for further replies.

sweetcats09

Programmer
Feb 5, 2007
7
US
Hi

I am trying to set input mask as
A followed my 9 digits..
example A123456789

I want A to be constant using code in VBA

Control.InputMask = "A999999999;0;_"

results in A being any alphabet. I want A to be a constant
as A_________

Can anyone help me with this?

Thanks
 
A backslash in front of a character causes that literal character to appear, i.e.

YourControl.InputMask = "\A999999999"

will place an A as the first character in the control.

TO keep input masks user friendly, you need to make sure that the cursor going into the field starts at the correct place.

If the user clicks into the control:
Code:
Private Sub YourControl_Click()
  YourControl.SelStart = 1
End Sub

If the user tabs into the field:
Code:
Private Sub YourControl_Enter()
  YourControl.SelStart = 1
End Sub

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top