http://www.moq3.com/pics/up/g_11_10_06/7190c4c32e.jpg
http://www.moq3.com/pics/up/g_11_10_06/ad7956cd79.jpg
http://www.moq3.com/pics/up/g_11_10_06/f3a4e126de.jpg
http://www.moq3.com/pics/up/g_11_10_06/fcbe752fc5.jpg
Thanks a lot
Farid Sukkar
![]() |
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'")
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...
http://www.moq3.com/pics/up/g_15_10_06/ec36096e9e.jpg
please help me.. thank you very much to you .
Best Regards
Farid Sukkar
I told you what to do, using the DSUMs. Did you try that?
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
Again, as a general rule we don't store calculated values. Use the DSum to display the value wherever needed.
All times are GMT -7. The time now is 06:47 AM. |