negative currency

G

Guest

I have a field with currency format.
I would like all numbers entered in this field to have a negative value.
any tips
thanks!
 
K

Ken Snell [MVP]

If you mean that all numbers entered should be less than zero, then set the
Validation Rule for the field to this:
<0
 
J

John Vinson

I have a field with currency format.
I would like all numbers entered in this field to have a negative value.
any tips
thanks!

If you want the user to be able to type 312 and have the value stored
as -312, put code like this in the Form textbox's AfterUpdate event:

Private Sub txtMoney_AfterUpdate()
If Me!txtMoney > 0 Then
Me!txtMoney = - Me!txtMoney
End If
End Sub

Note that you *must*, no option, use a Form to do this; table
datasheets have no usable events.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
A

Allen Browne

Here's a variation on John's idea.

It allows the user to type a positive sign in front of the number should
they need to override the negative interpretation.

Function MakeNegative(txt As TextBox)
If Not IsNull(txt.Value) Then
Select Case Asc(txt.Text)
Case 43, 45 'Plus or minus
'do nothing
Case Else
txt.Value = -txt.Value
End If
End If
End Function
 
J

John Vinson

Here's a variation on John's idea.

It allows the user to type a positive sign in front of the number should
they need to override the negative interpretation.

Function MakeNegative(txt As TextBox)
If Not IsNull(txt.Value) Then
Select Case Asc(txt.Text)
Case 43, 45 'Plus or minus
'do nothing
Case Else
txt.Value = -txt.Value
End If
End If
End Function

Point!

John W. Vinson[MVP]
 

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

Top