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

Input mask and format of textbox 2

Status
Not open for further replies.

magicmandan

Programmer
Mar 9, 2010
13
Hi,

I have an identification number (PRNid) stored as a integer in the underlying table.
On a data entry form i have a textbox with the control source set to PRNid.

I want to keep this number as an integer but when ever it is displayed on a form or report it need to take the format "N000" - without the quotation marks (e.g. PRNid 1 would be displayed as N001, PRNid 55 would be displayed as N055 etc).

For any reports where PRNid is displayed I know I can just format the field using the following syntax:

fPRNid = "N" & format([PRNid], "000")

However for the purpose of data entry how do I set up the textbox input mask and format properties so that;

a) if a PRNid of 1 has already been entered but the field does not have focus it is displayed as "N001".

b) when the textbox receives focus for new PRNid entry the input mask takes the form of N000 (where N is non editable and the zeros can be overwritten with numbers only).

c) when the textbox receives focus for an existing PRNid of 1 the input mask displays N001 with the same functionality as b) (including leading zeros)

Any help would be appreciated.
 
I'd don't mess with InputMask but the Format property of the TextBox.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
You could try set the Format property to:
[tt][blue]
\N000
[/blue][/tt]
This will display as you want but accept numbers. If you enter 93 and the focus leaves the text box, it will appear as N093.

Duane
Hook'D on Access
MS Access MVP
 
Thanks for your input.

\N000 works well as the display format. I was hoping to create an input mask as well using \N000;0;_

but unfortunately the leading zeros are not displayed just blank _ placeholders, so PRNid of 11 displays as N011 but when entering the field N_11 is displayed.

I guess unless anyone else can suggest how to display the leading zeros in the input mask i will have to suffice with just using format \N000.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top