A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

negative currency



 
 
Thread Tools Display Modes
  #1  
Old December 18th, 2004, 07:41 PM
external usenet poster
 
Posts: n/a
Default negative currency

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


  #2  
Old December 18th, 2004, 08:35 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

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

--

Ken Snell
MS ACCESS MVP

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



  #3  
Old December 19th, 2004, 12:32 AM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Sat, 18 Dec 2004 19:41:32 GMT, wrote:

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
  #4  
Old December 19th, 2004, 10:47 AM
Allen Browne
external usenet poster
 
Posts: n/a
Default

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


--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"John Vinson" wrote in message
...
On Sat, 18 Dec 2004 19:41:32 GMT, wrote:

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



  #5  
Old December 19th, 2004, 09:26 PM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Sun, 19 Dec 2004 18:47:21 +0800, "Allen Browne"
wrote:

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]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Currency or Double for currency values Tim Zych Database Design 8 November 10th, 2004 10:07 AM
Bogus Currency Formatting? r. howell Running & Setting Up Queries 1 September 12th, 2004 01:34 AM
problem getting currency formatting Paul James Running & Setting Up Queries 7 July 11th, 2004 08:46 AM
Negative numbers in formulas Bob Phillips Worksheet Functions 5 January 13th, 2004 05:13 PM


All times are GMT +1. The time now is 06:30 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.