|
 |
access thread: Freezing a character field and auto decimal in a currency field
Message #1 by "lateshia Daniels" <lateshia.daniels@n...> on Mon, 5 Mar 2001 17:16:23
|
|
I have set up a simple database that has two fields for staff to enter a
name and a dollar amount and get a subtotal by name and a grand total at
the end.
The database is now being used out of context so I would like to
accommodate the ures by fixing the name field to maintain the typed
name until it is replaced with another name.
In the dollar field I would like that field to read currency from right to
left and auto plug the decimal after the second number.
Ex: instead of keying 235.00 to get the result of $235.00 the user
could key in 23500 and get the end result of $235.00. Currently when
they key in 23500 the result is 23,500.00.
Message #2 by "John Ruff" <John_Ruff@m...> on Mon, 5 Mar 2001 10:35:43 -0800
|
|
To maintain the Name of the last person entered in the name field perform
the following:
1. On the txtName_BeforeUpdate event enter:
Private Sub txtName_BeforeUpdate(Cancel As Integer)
txtName.Tag = txtName
End Sub
2. On the forms Form_Current event enter:
Private Sub Form_Current()
If NewRecord And Len(txtName.Tag) > 0 Then
txtName = txtName.Tag
End If
End Sub
To format the dollar amount field perform the following on the
txtAmount_AfterUpdate event:
Private Sub txtAmount_AfterUpdate()
If Len(txtAmount) <= 2 Then
txtAmount = Format("." & txtAmount, "$#,##0.00")
Else
txtAmount = Format(Left(txtAmount, Len(txtAmount) - 2) & "." &
Right(txtAmount, 2), "$#,##0.00")
End If
End Sub
John Ruff - The Eternal Optimist :)
-----Original Message-----
From: lateshia Daniels [mailto:lateshia.daniels@n...]
Sent: Monday, March 05, 2001 5:16 PM
To: Access
Subject: [access] Freezing a character field and auto decimal in a currency
field
I have set up a simple database that has two fields for staff to enter a
name and a dollar amount and get a subtotal by name and a grand total at
the end.
The database is now being used out of context so I would like to
accommodate the ures by fixing the name field to maintain the typed
name until it is replaced with another name.
In the dollar field I would like that field to read currency from right to
left and auto plug the decimal after the second number.
Ex: instead of keying 235.00 to get the result of $235.00 the user
could key in 23500 and get the end result of $235.00. Currently when
they key in 23500 the result is 23,500.00.
|
|
 |