Forum Discussion

dmsitech's avatar
dmsitech
Copper Contributor
Mar 23, 2023

computations not putting result in correct field..

three fields are on the sub form. It is accessing the data correctly from the source table, but the result is not stored in the correct field. Here is the computation:

 

If Me![Workorder Line Item Quantity] > 0 Then Me![Workorder Line Item Amount] = Me![Workorder Line Item Quantity] * Me![workorder line item amount base] Else Me![Workorder Line Item Amount] = Me![workorder line item amount base]

 

It recognizes the If clause, but the computed result is stored in the [workorder line item base] field, not the [workorder line item amount] field. 

    • dmsitech's avatar
      dmsitech
      Copper Contributor

      Tom_van_Stiphout 

       

      It is a calculated field on the form. The result is stored in a field on the db.

       

      here is the code

       

      If Me![Workorder Line Item Quantity] > 0 Then Me![Workorder Line Item Amount] = Me![Workorder Line Item Quantity] * Me![workorder line item amount base] Else Me![Workorder Line Item Amount] = Me![workorder line item amount base]

       

      it is recognizing the "If" statement, but the result is stored in work order line amount base. the result should end up in workorder line item amount

       

       

       

      • dmsitech's avatar
        dmsitech
        Copper Contributor
        I believe i need someone to look at the actual form and underlying db

        i did connect with MS Support who looked at the db and said there are no errors, so they pointed me to the forum.

        How can i get hands on help?
  • arnel_gp's avatar
    arnel_gp
    Steel Contributor
    best is not to save the Computation in a Field (Workorder Line Item Amount), but just calculate it in a Query and use the Query as the RowSource of your form.

    select field1, field2,
    IIF(Nz([Workorder Line Item Quantity], 0) > 0, [Workorder Line Item Quantity], 1) * [workorder line item amount base] AS [Workorder Line Item Amount] FROM yourTableName

Resources