Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 6th, 2004, 11:22 AM
Tish Tish is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 15 Tish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 38 sec
Reputation Power: 0
Post Format Number in field based on previous field

Good Morning:

I have to reflect positive and negative currency amounts from a table called tblDocument with an "Amount" field. What is the simplest way for it to automatically generate a negative figure based on the previous called "DebitCredit" with the options of "C" or "D?" Additionally, how would I change the color to green and bold text if it is a positive figure? The form I'll be inputting into is called "frmDocTransaction." Thanks in advance for your help.

Reply With Quote
  #2  
Old December 6th, 2004, 01:11 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Hi Tish,

If you format your calculated textbox field as Currency, then negative numbers will display with () around the value...Example ($5.00) would be the same as a negative $5.00

To make the text bold and the color green for positive values, either on the On Current of the form or in the after update event of the field that triggers the calculation

If NameofTextBox.Value > 0 Then
With NameofTextBox
.ForeColor = 32768
.FontWeight = 700
End With
Else
With NameofTextBox
.ForeColor = 0
.FontWeight = 400
End With
End If
Use the name of your field that holds the calculated value in place of what is bold and in italics above.

lwells

Reply With Quote
  #3  
Old December 8th, 2004, 11:50 AM
Tish Tish is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 15 Tish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 38 sec
Reputation Power: 0
Quote:
Originally Posted by lwells
Hi Tish,

If you format your calculated textbox field as Currency, then negative numbers will display with () around the value...Example ($5.00) would be the same as a negative $5.00

To make the text bold and the color green for positive values, either on the On Current of the form or in the after update event of the field that triggers the calculation

If NameofTextBox.Value > 0 Then
With NameofTextBox
.ForeColor = 32768
.FontWeight = 700
End With
Else
With NameofTextBox
.ForeColor = 0
.FontWeight = 400
End With
End If
Use the name of your field that holds the calculated value in place of what is bold and in italics above.

lwells

Is there any way of automatically generating negative figure in the "amount" field once you tab into the field if the based on the choice of "D" in the creditdebit field prior to it (vice manually entering "-")? Thanks!

Reply With Quote
  #4  
Old December 8th, 2004, 01:44 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Hi Tish,

Change your Amount field from the Format of Currency to a custom format as follows:

$#,##0.00;-$#,##0.00[Red];

Then use the following code

If Selection = "D" Then
Amount.Value = Amount.Value / -1
ElseIf Selection = "C" Then
Amount.Value = Amount.Value
End If

This will place a "-" in front for the values of negative numbers and will be displayed in Red color assuming that "D" is for a debit and is to be displayed as a negative number.

lwells

Reply With Quote
  #5  
Old December 8th, 2004, 04:19 PM
Tish Tish is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 15 Tish User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 38 sec
Reputation Power: 0
Smile

Quote:
Originally Posted by lwells
Hi Tish,

Change your Amount field from the Format of Currency to a custom format as follows:

$#,##0.00;-$#,##0.00[Red];

Then use the following code

If Selection = "D" Then
Amount.Value = Amount.Value / -1
ElseIf Selection = "C" Then
Amount.Value = Amount.Value
End If

This will place a "-" in front for the values of negative numbers and will be displayed in Red color assuming that "D" is for a debit and is to be displayed as a negative number.

lwells

Thanks again for your help on this one!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Format Number in field based on previous field


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT