Ask Experts Questions for FREE Help !
Ask
    sukkarfarid's Avatar
    sukkarfarid Posts: 9, Reputation: 1
    New Member
     
    #1

    Oct 15, 2006, 02:52 AM
    Sum as type...








    Thanks a lot
    Farid Sukkar
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #2

    Oct 15, 2006, 04:30 AM
    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'")
    sukkarfarid's Avatar
    sukkarfarid Posts: 9, Reputation: 1
    New Member
     
    #3

    Oct 17, 2006, 12:52 AM
    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
  1. File Type: zip Test.zip (51.6 KB, 37 views)
  2. ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #4

    Oct 17, 2006, 07:09 AM
    I told you what to do, using the DSUMs. Did you try that?
    sukkarfarid's Avatar
    sukkarfarid Posts: 9, Reputation: 1
    New Member
     
    #5

    Oct 31, 2006, 02:04 AM
    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
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #6

    Oct 31, 2006, 06:26 AM
    Again, as a general rule we don't store calculated values. Use the DSum to display the value wherever needed.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Type H Fuse? [ 10 Answers ]

Me again,was told to buy a 30 amp disconnect for air conditioning unit.purchased an eaton/cutler hammer # 1 dpf221rp.it says it accepts class h fuses.cant seem to find anyone who knows what a class h fuse is.been to ace and home depot,can anyone help?? :confused:

Investing A Lump Sum? [ 3 Answers ]

Hello to you and yours. I am in the process of receiving a low to middle six figure settlement. I am a 30-something, married, and one child. We would like a portion to go directly to a Roth IRA for which we have none, and we want a portion of 25-40 percent to be used as a monthly income for us to...

What type of furnace to get [ 2 Answers ]

I am going to have to replace my furnace next year and I am wondering what type of furnace to gfet I am also going to have to replace my central air unit to. We have a gas furnace right now but the furnace it not going to last. When I was looking at ca units I saw ones with heat pumps. The...

I need sum help [ 7 Answers ]

Okay, I'm 15 years old, and I started dating this 19 year old about a week ago. Well we decided to go to the movies with a couple friends yesterday. Well when we went we got really close. I ended up giving him a blow job and stuff, and it was my first time ever doing anything but making out.. I...


View more questions Search