• AfterUpdate evet (Access 2000)

    Author
    Topic
    #442223

    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 ?

    Viewing 0 reply threads
    Author
    Replies
    • #1063941

      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.

      • #1063966

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

        • #1063969

          I’ll get back to you later today.

        • #1064012

          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.

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

          • #1064022

            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 ?

            • #1064039

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

            • #1064053

              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

            • #1064530

              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

            • #1064548

              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.

            • #1064584

              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

            • #1064588

              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.

            • #1064767

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

              kind regards

              Solar

    Viewing 0 reply threads
    Reply To: AfterUpdate evet (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: