Extending Input Mask

S

Smiley01

I have a text field 12 characters in length. With input mask 000000/-0. I
want to add another character at the begining of the field by changing the
input mask to be equal to 0000000/-0. When I do this it adds the zero to the
end of the field thus changing the number. I want to add the zero to the
begining not the end.

Any help would be appreciated!
 
K

Ken Sheridan

I assume the mask is in fact 0000000\-0 to make the hyphen a literal character.

Start by adding the zero to all existing 7-digit values with an update query:

UPDATE YourTable
SET YourField = "0" & YourField
WHERE LEN(YourField) = 7;

For new records the user will now have to insert the leading zero where
necessary of course.

Ken Sheridan
Stafford, England
 
S

Smiley01

Thanks for the reply....it now says failure to update due to a type
conversion failure. Yes the hyphen is a literal character.
 
S

Smiley01

Fixed.....Thanks

Ken Sheridan said:
I assume the mask is in fact 0000000\-0 to make the hyphen a literal character.

Start by adding the zero to all existing 7-digit values with an update query:

UPDATE YourTable
SET YourField = "0" & YourField
WHERE LEN(YourField) = 7;

For new records the user will now have to insert the leading zero where
necessary of course.

Ken Sheridan
Stafford, England
 
K

Ken Sheridan

Make sure that:

1. The column is text data type.
2. Its length is at least 8 characters.
3. The table and column names in the SQL statement exactly match yours.
4. Any table or field name which contains spaces or other special
characters is wrapped in square brackets in the SQL statement, e.g. [Your
Table], [Employee#] etc. If in doubt include the brackets.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Remove input mask format 4
Input Mask in tables 2
input mask 4
Droping Leading Zeros In Table 4
Input Mask - Date and Time 7
Input Mask 1
Input Mask or Validation? 24
Number Reverts to Zero 5

Top