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

Control display / update format of field

Status
Not open for further replies.

avantgd

Programmer
Jan 22, 2002
16
US
I have a table with a field called Material # that is 18 characters. When I display this field on the form, I only want to show the right 10 characters. When a user updated the field, I need to pad the left with zeroes, "0", update the table and then only display 10 characters.

I have tried using the before update and after update methods to control this. However, the form misbehaves.

Please help.
 
How are ya avantgd . . .

Interesting! . . . just how is the aditional 8 characters hurting you in display?

Calvin.gif
See Ya! . . . . . .
 
First of all this is a bad name.
Material #
Never use spaces in names, and never use reserved characters in names (i.e. #). You are begging for problems.

The easiest way would be to seperate the input and the viewing of the data. To do this is use an unbound calculated field to display it the way you want. But in order to enter data you would have to provide a means to do this. A simple way would be a click event on that field that pops open a small form to edit that field

The other way would be to use the on current event to populate an unbound field. Something like

Private Sub Form_Current()
Me.txtBxMaterial = "00000000" & Right(Me.[Material#], 10)
End Sub

Private Sub txtBxMaterial_AfterUpdate()
Me.[Material#] = Me.txtBxMaterial
call Form_Current
End Sub

But I am not sure how you want this to work. What does the user input to update the field? In this example I assume he types in the entire 18 digits, but that does not make much sense for a user interface.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top