Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / December 2004

Tip: Looking for answers? Try searching our database.

negative currency

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
- 18 Dec 2004 19:40 GMT
I have a field with currency format.
I would like all numbers entered in this field to have a negative value.
any tips
thanks!
Ken Snell [MVP] - 18 Dec 2004 20:35 GMT
If you mean that all numbers entered should be less than zero, then set the
Validation Rule for the field to this:
   <0

Signature

       Ken Snell
<MS ACCESS MVP>

>I have a field with currency format.
> I would like all numbers entered in this field to have a negative value.
> any tips
> thanks!
John Vinson - 19 Dec 2004 00:32 GMT
>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
Allen Browne - 19 Dec 2004 10:47 GMT
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

Signature

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.

>>I have a field with currency format.
>>I would like all numbers entered in this field to have a negative value.
[quoted text clipped - 17 lines]
>        Tuesday 11am EDT - Thursday 3:30pm EDT
>      http://community.compuserve.com/msdevapps
John Vinson - 19 Dec 2004 21:23 GMT
>Here's a variation on John's idea.
>
[quoted text clipped - 11 lines]
>    End If
>End Function

Point!

                 John W. Vinson[MVP]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.