Adapting Allen Browne's Quantity On Hand to Include Inventory Adjustments Between Stock-takes


I need to amend Allen Browne's Function OnHand (as found here:
to include Inventory Adjustment (between Stock-Takes) using tblAdjustments and tblAdjustmentDetail.

I'm inclined to place the ffg. :

- after:  Dim lngQtyUsed As Long                 'Quantity used since stocktake.
              Dim lngQtyAdjusted As Long          'Quantity adjusted since stocktake.   <-- new declaration

 before the last "End If"

'Get the quantity adjusted since then.
strSQL = "SELECT Sum(tblAdjustmentDetail.Quantity) AS QuantityAdjusted " & _
         "FROM tblAdjustments INNER JOIN tblAdjustmentDetail ON " & _
        "tblAdjustments.AdjustmentID = tblAdjustmentDetail.AdjustmentID " & _
            "WHERE ((tblAdjustmentDetail.ProductID = " & lngProduct & ")"
        If Len(strDateClause) = 0 Then
            strSQL = strSQL & ");"
         strSQL = strSQL & " AND (tblAdjustments.AdjustmentDate " & strDateClause & "));"
        End If

      Set rs = db.OpenRecordset(strSQL)
        If rs.RecordCount > 0 Then
            lngQtyAdjusted = Nz(rs!QuantityAdjusted, 0)
        End If

Then replace Allen Browne's:
        'Assign the return value
        OnHand = lngQtyLast + lngQtyAcq - lngQtyUsed

       'Assign the return value
        OnHand = lngQtyLast + lngQtyAcq – lngQtyUsed + lngQtyAdjusted

My question:
Will the above yield the correct Quantity On Hand ?

Kind Regards,
Mohamed SinghAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
Will the above yield the correct Quantity On Hand ?
...try it and see...

Mr Browne does state on his site that he cannot provide support, ...
But you can try... the very least you can ask him if he is wiling to create a custom version of his function for you...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.