Ask Experts Questions for FREE Help!
  Advanced
Register  |  Log in  
   Ask    
 Answer  
  Help  

Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
Free Answers in 3 Easy Steps

Register Now
3 Steps

At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.

Home > Computers & Technology > Programming > Compiled Languages > Visual Basic   »   sum as type ....

 
Thread Tools Display Modes
Question
 
 
#1  
Old Oct 15, 2006, 01:52 AM
sukkarfarid
New Member
sukkarfarid is offline
 
Join Date: Sep 2006
Posts: 10
sukkarfarid See this member's comment history on his/her Profile page.
sum as type ....









Thanks a lot
Farid Sukkar

Reply With Quote
 
     

Answers
 
 
Old Oct 15, 2006, 03:30 AM   #2  
Computer Expert
ScottGem is offline
 
ScottGem's Avatar
 
Join Date: Jan 2003
Location: LI, NY - USA
Posts: 24,004
ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.
Pay to call ScottGem for advice ($.75/min)
Call ScottGem via Skype™
It would help if you told us what platform you are working in. The code appears to be Access VBA. So I'll answer for that.

First you don't actually need any code to do this. If you set the ControlSource of the No3 Control to:

=IIF([Type] = "Output",([No1]*-1)*[No2],[No1]*[No2])

That will do what you want.

Second, As a general rule we do NOT store calculated values. Therefore to sum the results, you need to use a query. In Query Design mode add your table and add the three fields (Type, No1, No2). Then add a 4th column with the expression:

No3: IIF([Type] = "Output",([No1]*-1)*[No2],[No1]*[No2])

Now on your form, add unbound controls with a ControlSource of:

=DSUM("[No3]","Queryname","[Type] = 'Output'")
=DSUM("[No3]","Queryname","[Type] = 'Input'")
  Reply With Quote
 
     
 
 
Old Oct 16, 2006, 11:52 PM   #3  
New Member
sukkarfarid is offline
 
Join Date: Sep 2006
Posts: 10
sukkarfarid See this member's comment history on his/her Profile page.
thank you ScottGem for help me ...
i try the code you give to me ... and i have a problem ... that the sum of result of all
input , and of all output ..

i upload to you the program picture , and i upload to you my test program ...


please help me .. thank you very much to you .
Best Regards
Farid Sukkar
Attached Files
File Type: zip Test.zip (51.6 KB, 6 views)
  Reply With Quote
 
     
 
 
Old Oct 17, 2006, 06:09 AM   #4  
Computer Expert
ScottGem is offline
 
ScottGem's Avatar
 
Join Date: Jan 2003
Location: LI, NY - USA
Posts: 24,004
ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.
Pay to call ScottGem for advice ($.75/min)
Call ScottGem via Skype™
I told you what to do, using the DSUMs. Did you try that?
  Reply With Quote
 
     
 
 
Old Oct 31, 2006, 12:04 AM   #5  
New Member
sukkarfarid is offline
 
Join Date: Sep 2006
Posts: 10
sukkarfarid See this member's comment history on his/her Profile page.
thank you for help me ...
i try the query , and it's a successfully query ...
i have question for this query ...
when i input the data on the table the sum of this data not show , but when i go to next record and back to my record , the sum of data appears .

how i can when i input the data the .... the sum appear direct

Thnaks
Farid
  Reply With Quote
 
     
 
 
Old Oct 31, 2006, 04:26 AM   #6  
Computer Expert
ScottGem is offline
 
ScottGem's Avatar
 
Join Date: Jan 2003
Location: LI, NY - USA
Posts: 24,004
ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.ScottGem See this member's comment history on his/her Profile page.
Pay to call ScottGem for advice ($.75/min)
Call ScottGem via Skype™
Again, as a general rule we don't store calculated values. use the DSum to display the value wherever needed.
  Reply With Quote
 
     


Thread Tools
Display Modes

 
Similar Sponsors

Similar Threads
Question Asker Forum Answers Last Post
Type H Fuse???? GEORGE HUBBARD Electrical & Lighting 9 Apr 23, 2007 11:45 AM
What type? jvibe101 Music 0 Sep 14, 2006 05:19 PM
Investing A Lump Sum??? mz2richard Investing 3 Mar 28, 2006 03:50 PM
What type of furnace to get ncraiders Heating & Air Conditioning 2 Oct 3, 2005 08:40 PM
i need sum help K_Loveable05 Teens 7 Aug 17, 2005 07:37 AM




Copyright ©2003 - 2007, Ask Me Help Desk.
All times are GMT -8. The time now is 11:20 PM.