How do I hide data in a text box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a text box control on a form that is tied to a 3-digit number (010).
The first digit is always "0". I would like to hide this leading digit from
the user.

Users will enter data in this field. I would like them to enter only
2-digits on the form but have that store as the 3-digit number.

I have played with masks in the Format Property like "#0", "0","0#".
Nothing seems to work.

How can I accomplish this?
 
On the before update event of the field you can write

Me.[TextBoxName] = Format(Me.[TextBoxName],"000")

So the user will enter 2 digits, but it will add to it a leading 0
 
OK, that sound like that will work for the update part.

How do I get the text box to only display the last two digits all the time,
when the field associated with the text box is a 3-digit field?

Ofer Cohen said:
On the before update event of the field you can write

Me.[TextBoxName] = Format(Me.[TextBoxName],"000")

So the user will enter 2 digits, but it will add to it a leading 0

--
Good Luck
BS"D


Al said:
I have a text box control on a form that is tied to a 3-digit number (010).
The first digit is always "0". I would like to hide this leading digit from
the user.

Users will enter data in this field. I would like them to enter only
2-digits on the form but have that store as the 3-digit number.

I have played with masks in the Format Property like "#0", "0","0#".
Nothing seems to work.

How can I accomplish this?
 
The problem with displaying the data with no leading zero, is that you wont
be able to update this field.

To remove it
=Val([FieldName])

So you can use it in a query for display purpose.

--
Good Luck
BS"D


Al said:
OK, that sound like that will work for the update part.

How do I get the text box to only display the last two digits all the time,
when the field associated with the text box is a 3-digit field?

Ofer Cohen said:
On the before update event of the field you can write

Me.[TextBoxName] = Format(Me.[TextBoxName],"000")

So the user will enter 2 digits, but it will add to it a leading 0

--
Good Luck
BS"D


Al said:
I have a text box control on a form that is tied to a 3-digit number (010).
The first digit is always "0". I would like to hide this leading digit from
the user.

Users will enter data in this field. I would like them to enter only
2-digits on the form but have that store as the 3-digit number.

I have played with masks in the Format Property like "#0", "0","0#".
Nothing seems to work.

How can I accomplish this?
 
Ofer said:
I have a text box control on a form that is tied to a 3-digit number (010).
The first digit is always "0".

The problem with displaying the data with no leading zero, is that you wont
be able to update this field.

To remove it
=Val([FieldName])

With reference to another thread
(http://groups.google.com/group/micr..._frm/thread/539085b8b736d6d9/fe60b65955b00e66),
can I ask why you chose to cast the double float rather than an
integer?

I've noticed over the last couple of days that some of the regulars in
the Access groups use Val which, given the nature of double floating
point values, would seem an odd choice when more explicit casting
functions are available.

TIA,
Jamie.

--
 
Back
Top