Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Text Box Input Mask

I have a form to enter new customers, I want an input mask in the account number text box so the user doesn't have to enter the hyphens, ##-##-##

Can anyone tell me if this can be done and give me an idea of how to do it. I know it is pretty easy to do in ACCESS. I haven't been able to find out how to do it in VB.

Dale S

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Input Mask In Text Box
Hi all, is there a way to set input mask in a text box, for instance, if a user start typing in a date text box, the text box will display "00/00/0000" something like that? not necessary need to have 0 between "/", even blank space is fine. Thanks in advance.

Input Mask On Text Boxes?
I need to check that what the user enters when adding a record is correct. eg: that DOB is in the form **/**/**, that telephone has no letters, that name has no numbers etc.

How would i go about doing this??






Input Mask
hey, this is probably easy to answer but how do i get a text box that only accepts numeric values and shows ### in the text field, something like in access.

Input Mask Help
I'm using a VB input mask (from a maskEdBox) to validate zip code and phone number. What's the best way to remove that formatting before it goes back to a database (access database w/ ADO connection)? I'm running the code from a form, to a Business class module, to a Database module, then to the DB. Thanks!!

Set Input Mask Via SQL
what's the syntax for programmatically setting a field's input mask with SQL?

With something like...

"CREATE TABLE tblMyTable (Name varchar(50), Section varchar(25), User varchar(30), SSN varchar(25));"
... how could I set the Input Mask for the SSN field to be 000-00-0000 ?

Input Mask
I have a query that prompts the user to enter a date. I have an input mask
that is supposed to force the user to enter mm/dd that looks like this:
This was generated by right clicking in the criteria box of the birthdate
field, selecting properties, then clicking the elipsis on the input mask
box and going through the input mask wizard. When I test the mask in the
"Try It" box it works as expected. Only letters are accepted and the forward
slash automatically is entered at the third character. When I run the query
and am prompted for the date, I am able to enter letters and there is no
forward slash. Can anyone please help me?

Input Mask
Hello people.

I want to use an input mask in my program but i dont know how?

The data formats i need are as follows.

Short Date (DD/MM/YYYY)

A Licence Number (LLLLLNNNNNNLLNNLL) L = Letter, N = Number

If any one could help that would be great. I am looking for a simple code if possible.

Much Appreciated

Input Mask
Is there a way to put an input mask on a regular text box?


Input Mask
How can I enter an input mask without using the masked edit control?

Try to use a phone number:

Input Mask Err Msg

I set "00000;;_" to the 'Input Mask' property of a TextBox in MSAccess. When
I enter number less than 5 digit and move to another control, MS Access
raises an error. my question is how can I raise my own error msg, and stop
raising the builtin one?

Thanks a lot in advance.


Input Mask
Hi everybody!
Does anybody know a simple way to mask the input from keyboard to a textbox to a specific number of integer part digits and a number of decimals?
br ChristerL

Input Mask Question
is an input mask i use for a date field.
i am looking to display dates like 06/06/2002
i don't want the zero's to drop out.

my question is this, if i understand everything correctly,. the 9s are optional characters, and the 0s are mandatory. this is an input mask that the input mask wizard built for me. why would it chose this style since i want the all 8 characters to show up?

thank you

Alternative To Input Mask?
you know when you enter a cd key into an installation program and lets say the key takes the form 1234-123-1234,there are three text boxes and once youve entered four charactrers in the first box the focus shifts to the second without pressing tab,any way of doing that with vb? I'd prefer not to use just one text box and and an input mask

MS Access Input Mask
I'm having trouble with something that seems like it should be easy... hopefully one of you are able to see my error.

I have a large SQL database with a MS Access front-end. Within the front-end I have a form where users enter in test results that are saved to the back-end. When a user clicks "Save" I am popping up another form that ask the user to verify the test results by entering their userid and password. On the popup form the user selects their userid from a combo box and then types their password in a textbox. I have the textbox input mask set to "password" so it hides the characters they type with asterisk (****).

Here's what the trouble is: I have a simple If-then statement that checks the typed password against the one stored in the database. The problem is when I set the input mask to "password" the if-then statement seems to evaluate the typed password as asterisks (****) and fails to recognize the underling characters. If I "turn off" the input mask, everything works fine.

Can anyone tell me how I can use the input mask but still have the if-then statement recognize the characters that are being input?

I know I'm probably missing something simple, but I just can't seem to figure it out.

Thanks to all

Input Mask For Textbox
hi i did search but i didnt find quite what i was looking for. from reading the forums i have found out that there is no input mask control that comes with the textbox but there may be something in the components?
I have a textbox used for the post/zip code and i need an input mask but i dont know how to get an input mask. if anyone has any suggestions or code that could help please could you explain it to me as well so i get an understanding of what is happening. Thanks in advance

Input Mask On Textbox
I have a textbox in my form that the user will insert his E-mail address into. Is it possible to add a input mask to the textbox to ensure a valid e-mail address is inserted? If so, How

Access Input Mask
How can I make an email input mask for Access?

How To Set Input Mask Dynamically In VBA

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?


MS Access: Disappearing Input Mask
I have the following code that assigns an input mask to an unbound text box:

new_PN.InputMask = "" & Mid(baseselector.Value, 1, 1) & "" & Mid(baseselector.Value, 2, 1) & _
"" & Mid(baseselector.Value, 3, 1) & "" & Mid(baseselector.Value, 4, 1) & _
"" & Mid(baseselector.Value, 5, 1) & "" & Mid(baseselector.Value, 6, 1) & _
"" & Mid(baseselector.Value, 7, 1) & "99;0;_"
Here's my setup: in the text box I want them to be able to enter/change the last two digits only. The first 7 need to be static and defined by the first seven digits of my listbox's value.

Here's what's happening: the 7 digits only show when the text box has focus and after I enter the two numbers on the end and leave the textbox, the first seven numbers disappear from view and from the Value of the textbox! I tried including the second argument as 0 in the InputMask property, but it didn't help at all. Any ideas?

Input Mask Object Library

2 questions:

What is the name of the object library that has input masks for dates. In the text box, it would like this "__ /__ /__" for the object I need. I think it's some active x control but I don't know?

Also, is there a way to add your own objects/controls to the toolbox? I would like to drag and drop objects that I make complete with the code behind them.


Mask Edit Box Input Problem
Hi to All,

I have a MaskEdBox for SSN, with mask "###-##-####".
The properties for PromptInclude=False (i.e. uncheck), HideSelection=False (i.e. uncheck), AllowPrompt=False (i.e. uncheck).
On the form, the user will see the following in SSN box "___-__-____"
When clicking the SSN box to enter data, the cursor may falls
on the 3rd or 4th position in the box and one types something like
"__3-45-6789". I want that each time you click the SSN box, the cursor be at the left most position or that one is unable to get something like "__3-45-6789" or "1_3-45-6_78" in the SSN box.

Input Mask For A Queries Parameter
Is there a way to have an input mask for the paramter box that pops up for a query?

Making A Input Mask For A Textbox
How can you make a input mask for a textbox.
It has to look like this:
xxº-xx.xx' x

The first 5 x's can only be numbers and the last x can only be a N,E,S or W.
Can anyone tell me how to do this??

Input Mask For Email Address
i am using VBA DAO in access and i have a field where applicants enter their email address there, does anyone know the code or even the input mask for it?

Setting Input Mask For IP Addresses?
How can I set a input mask on a text box used for inputing IP addresses?


Creating An Input Mask In Access
Dear Vb users,

How do I create an Input mask in my field.

Set DB = CreateDatabase(DbSetting, dbLangGeneral)
Set TD = DB.CreateTableDef("MyTable")
With TD
.Fields.Append .CreateField("MyField"), dbText)
End With

How do I get an input mask for field "MyField??????

"Nice greetings,


Please Need Help For Date Input Mask In Datagrid
Hi all,

just simple question about datagrid
my datagrid is supposed can do add, delete and update operation.
but i have a coloumn which is DATE field type, and i want to mask it so the user just input only numbers. (##/##/##)
now my question is, can i do it with the datagrid control?

if the only way is manually using masked edit anybody can help me with the logic for the focus change between datagrid and the masked box it self when moving on row/column?

please any help or suggestion is needed..
thanks alot.


Error Trapping Input Mask Violations
How do I error trap an input mask violation so I can display a more user friendly message?

Input Mask Datagrid Access 2000
basically, have one field in my table which is time

i have set up an input mask in access so is formated to "##:##"

however in my application using ADO connection to Access, when i type in the box as "####' it comes back with a mismatch error, and i have to type "##:##" for it to enter the data

is there a way i can put an input mask on the datagrid to force the input to put the : in like the input mask on the access table

have tried a few things but cant get to work

any help wud be apprieated

Maintain Input Mask While Clearing Fields
Problem: Maskedbox input mask lost on clearing of fields

Hello, im trying to figure out how to maintain my input mask after i clear the masked box,
using this:

frmenterdata.MaskEdBox1.Mask = ""
frmenterdata.MaskEdBox1.Text = ""

frmenterdata.MaskEdBox2.Mask = ""
frmenterdata.MaskEdBox2.Text = ""

It loses its input mask once i press my data enter button which uses the following code:


Private Sub cmdenterdata_Click()
Dim dataenter As String

'Built-in method to add a new record

'clears all fields

'clears fields that didnt clear the first time
chkditch = "0"
chkmv = "0"
chkrip = "0"
chkculverts = "0"
chkBridges = "0"
chkbufferzones = "0"

'disables enterdatabutton, the reason is: if this button is pressed twice
'an error will occur, so the error is caught before it occurs
cmdenterdata.Enabled = False

'Message Prompt
dataenter = MsgBox("Please enter the data in the blank fields provided, once finished use the navigation buttons to confirm the data has been entered", vbInformation + vbOKOnly, "Data Entry Instructions")

frmenterdata.MaskEdBox1.Mask = "##/##/##"
frmenterdata.MaskEdBox2.Mask = "####-##-###"

End Sub


Note: the 2 MaskedBox's are linked to my data control

Anyone have any solutions on how i can maintain my input masks while still clearing my fields??

Thanks in advance

Access 2000-creating An Input Mask
Creating Input Mask for currency

When creating an Access database, in design view, by default requires the data entry for currency to be put in with manually using the “.”
* When you type in the currency field “899”
by default Access formats it $899.00

What I want to do, is get rid of one key stroke and eliminate having to use a decimal to show the cents
* when “899” is keyed in it will look like this “$8.99”

I have searched and search on the net and tried many masks that seem logical but nothing will over ride the default that works

Please help!!
Your input is greatly appreciated

Maintain Input Mask While Clearing Fields
Problem: Maskedbox input mask lost on clearing of fields

Hello, im trying to figure out how to maintain my input mask after i clear the masked box,
using this:

    frmenterdata.MaskEdBox1.Mask = ""
    frmenterdata.MaskEdBox1.Text = ""

    frmenterdata.MaskEdBox2.Mask = ""
    frmenterdata.MaskEdBox2.Text = ""

It loses its input mask once i press my data enter button which uses the following code:


Private Sub cmdenterdata_Click()
    Dim dataenter As String
    'Built-in method to add a new record
    'clears all fields
    'clears fields that didnt clear the first time
    chkditch = "0"
    chkmv = "0"
    chkrip = "0"
    chkculverts = "0"
    chkBridges = "0"
    chkbufferzones = "0"
    'disables enterdatabutton, the reason is: if this button is pressed twice
    'an error will occur, so the error is caught before it occurs
    cmdenterdata.Enabled = False
    'Message Prompt
    dataenter = MsgBox("Please enter the data in the blank fields provided, once finished use the navigation buttons to confirm the data has been entered", vbInformation + vbOKOnly, "Data Entry Instructions")

    frmenterdata.MaskEdBox1.Mask = "##/##/##"
    frmenterdata.MaskEdBox2.Mask = "####-##-###"

End Sub


Note: the 2 MaskedBox's are linked to my data control

Anyone have any solutions on how i can maintain my input masks while still clearing my fields??

Thanks in advance

Allowing User To Create Or Change Input Mask
I'm a novice with VB6.

I want users to be able to define their own input mask and store it in a table.
After which they can then input into another table based on the predefined input mask.

If the input format is not the same as predefined input mask it should prompt users.

Setting The Input Mask Property On An ADO Created Field
I have an Access database created in ADO and I can not figure out how to set the Input mask property on a field. any help that can be given on this would be greatly apreciated

TExt Box Mask
Hey, is their anyway to mask a text box so that it has a minimum of 6 characters?

Mask Text Box
I have MSMASK.OCX and I tried to use it but never this controller work,anyway here is my question?

tired about MSMask I do not want to know anything more about this controller. How can I mask a text box? for example a telephones text box with this format (###) ###-#### on a user dataentry form. Also how can I mask another . text box with this format ##/##/## for a date, I means do to have to use the MSMask controller.

Thank & Regards

Text Box Mask???
To anyone which can help me..

Can I set a input mask in the textbox?
I try the DataFormat but it does not work with text that is not link to a datasource. How to set it in a way that it can validate the input at runtime.
Example : 1/2/01
When I type a number,
The Textbox will show the format __/__/__
Thanks a million to all who can help me.

Good Jobs!

Replace Text Using Mask?
I wonder if it would be possible to replace text in a string but using a mask.

For exemple:

VB Code:
Dim myString as String myString = "011A210z3!11354z56778!4w64444E+4444F65547D9784V66464-467979+my Message in here..."

My ideia would be to replace: "011A210z3!11354z56778!4w64444E+4444F65547D9784V66464-467979+"
by !11211!

That String may be diferent, i mean, the string isn't the same, so i can't use the replace() function
The only thing that wil be always the same are the signals ! + - but the number of letters and number may change.

Any idea?

Can I Mask My Text Box/List Box ?
Good day !

Let say I have enter an floating point value in a text box, it will be converted to Text right ? atuomatically.

How can I force my program to display or treat it as a Currency ? Although I have declared a currecy variable to store it, still, it's just normal integer. I can't have it to have 2 decimals by default ?

Same thing happen to list box also. Let say I have a list of numbers , how can I convert each data item of integers into currency type. For example, if the data is 50, how can I change it to $50.00 without manually convert it ?

Thanks a lot !

Sonic Wave

Create A Mask In Text Box?
hi everybody
In a text box, can I create a mask? Like MASKEDITBOX.
For example, if create a mask in text box like “__/__/____”. Here the ‘/’ should not be deleted. Also when I type any number in ‘__’ space the line should be removed.
Also, how I know the cursor is now in which position in text box. E.g.: - in the text box, there are 5 digits. ‘12345’. How I know where is the cursor position?

Of if create a number control by text box, the format always I need ‘0.00’. this should be deleted. And when I enter a number. Always it should convert to control’s format.
How far I can do this?
Anybody can help me?

Use Mask Picture &lt;&gt; Create Mask At Runtime
Hi all,

I keep coming across these two methods and was wondering which method is best, or rather what are the pro's and con's of these two methods?



I am trying to filter the string

Adding Text Mask In Excel Cells
I'd like to know wheter it's possible to Add a text mask to Excel cells, just like in a VB TextBox.

I want to define a time mask (__:__), for "Hour:Min" to be entered without having to type the colon.

I've searched MSDN but couldn't find it. Can anybody help?

Extra Info:
Trust me, it's not laziness, it's really a lot of data to be typed (about 5.000 lines daily), and this would really ease the work of those who type the data.
There are 26 time fields per line. Make your calculations!

Mask Edit Control Selection Text
If the user enters an invalid date for the date mask edit control (mskDate) I'm telling the user they have an invalid date... then i (want) to select the entire text they put in ... but it's not working.... how is this supposed to be done..

here is what i have

If Not IsDate( mskDate.Text )
msgbox "NO... etc"
mskDate.SelStart = 0
mskDate.SelLength = Len( mskDate.Text )
End If

it's not working though... any clues?


*RESOLVED* Using Text File As String Input For Opening Other Text Files
OK, I've been banging my head trying to get this one little piece to work (that I had working prior to a loss of power on Friday) but I cant remember the syntax I used to get it right.

What I'm doing is opening 1 text file and using it as the input in a loop to open and parse mutiple text files to a text box.
Heres the part that doesn't work;

Open "rbt.txt" For Input As 1

Do Until EOF(1)
Open " " & rbt.txt & ".txt" For Input As 2 'THIS IS THE PART THATS not working !

Line Input #2, slist
s = s & slist & vbCrLf

Upt_log_txt.Text = s


I know its a syntax (read as placement) issue but I cant get the right combo down.

Changing The Text In The Text Box, But Letting The User First Input What He Wants
i have a textbox that holds a value that cannot be less then 2 or higher then 10.
i want the user to be able to input the value, but if i use this code i can't write the value 10:
If Txt1.Text < 2 Then Txt1.Text = 2
If Txt1.Text > 10 Then Txt1.Text = 10

agian, if i now try to type 10 then value will go to 2 and the be "02"
if i type 45 it will become 10.
i don't want this, i only want to be able to put the specific numbers 2-10.


Text Box Input Not?
I want to have a situation where I can enter text in a Text Box and Have a
For - Next loop displaying diferent text on the screen at the same time? Can anyone show me how this could be done, I tried several ways and can't do it!!

How Do I Input A Txt And Add Text
Open App.Path & "
etreminder.txt" For Output As #1
Write #1, Text1.Text
Close #1

I want it to write text in a txt file and when and other time, when i input text again, it will add on to it but not overwriting it.
Does this code correct? but when i excute, it overwrite the txt in it. =(

Copyright © 2005-08, All rights reserved