Results 1 to 13 of 13
  1. #1
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AfterUpdate evet (Access 2000)

    In the BeforeUpdate event of the form i have the following code ?
    Me!extendedprice = (Me!Quantity * Me!NewUnitPrice)

    i want to use a calculated field that occurs after the update, so onvisouly i have to remove the code in the afterupdate event. But removing that i will not work. Why is that ?
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: AfterUpdate evet (Access 2000)

    At the moment, ExtendedPrice is a field in the table Order Details. If you want to make it a calculated field, you must remove it from the table, and add it as a calculated field to the query.

  3. #3
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AfterUpdate evet (Access 2000)

    Thank you for your reply. Sorry I cannot express myself clearly.Anyway what I want is to calculate the field
    Attached Files Attached Files

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: AfterUpdate evet (Access 2000)

    I'll get back to you later today.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: AfterUpdate evet (Access 2000)

    The subform cannot be used. I already pointed out to you (or whoever posted as 'solar') that qryAmount is not updatable, so you cannot use it in the record source of the form. Please see <post:=648,836>post 648,836</post:>.

    You write 'Placing the above code it in the beforeupdate event is not logical'. Why not?

  6. #6
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AfterUpdate evet (Access 2000)

    Thank you Hans !
    In the underlying query i use now the DLookup function to find the price.It is OK, i just cannot calculate the extended price.The line
    Me!extendedprice = (Me!Quantity * Me!NewUnitPrice) just does not work.
    My problems will be solved if I succeed somehow to obtain the extended price so as to be seen on the list box on the screen.I think it is not logical to be in the before update because Access does not know how many liters will be bought and hence cannot calculate the discount. Therefore, if I write Me!extendedprice = (Me!Quantity * Me!UnitPrice), the extended price will be obtained. Jist to make myslef clear. Unitprice is the usual, convention al price and the NewUnitPrice will be the price calculated with the percentage discount calculated as per the previous thread.Can you help ?
    Attached Files Attached Files

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: AfterUpdate evet (Access 2000)

    Instead of using code, calculate everything in the queries. I have removed the calculated fields from the table and added them to the queries.
    Attached Files Attached Files

  8. #8
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AfterUpdate evet (Access 2000)

    Thank you Hans, for everything. I am deeply grateful.I will work on it the next days but i want to express my gratitude now.Thank you

  9. #9
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AfterUpdate evet (Access 2000)

    Could you help me modify the database ? I need to make the folowing modifications:

    1. The whole discounting procedure should refer only when kindid from table tkind is 13, denoted by "extra".Therefore to each cliend a category is assigned, in my case it ia client aaa, who has tkind = extra.
    2. When case is 13, the Unit price should be = office :
    Case 13
    Me!UnitPrice = Me!office
    3. In the AFter update event of the cartons, i want to make the field Me!Unit price = Me!NewUnitPrice. In this way it will be easier to make the further calculations
    I tried many times but i cannot do it. Will you help ?

    kind regards

    Solar
    Attached Files Attached Files

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: AfterUpdate evet (Access 2000)

    In my previous reply I tried to show you that it is possible - and much more efficient - to use queries to do the calculations. Why do you want to revert to VBA code now?
    Apart from that, your database doesn't contain any orders that can be used to test.

  11. #11
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AfterUpdate evet (Access 2000)

    Oh Hans I know that but my database is very complicated and I must include all the conditions in it.Apart form that I didn
    Attached Files Attached Files

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: AfterUpdate evet (Access 2000)

    I think you should change the setup. Use a separate table to list the prices for each KindID in a separate record, instead of using fields office, cons, dealer etc. You can then calculate the price in a query. See the attached version.
    Attached Files Attached Files

  13. #13
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AfterUpdate evet (Access 2000)

    Thank you so much! I am starting to rearrange my set up

    kind regards

    Solar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •