Hi Guy's can anyone help with this one please
I have 3 item numbers in tblEdit with 200871 added with status planning
tblStock shows we have got 3 in stock
i am wanting to achieve looking up if any of this number is allocated ie: planning or on hold and recalculate in the stock table the following
StartQty 3
Allocated Qty 3
NewQty 0
The following is the code i have that is returning
StartQty 3
AllocatedQty 10769
NewQty -10766
There was only ever 3 in stock ?????
Code:
Dim mHold As String, mPlan As StringDim mLiftNo As Long, mStartQty As Long, mAllocated As Long, mNewQty As Long
mStartQty = Me.StartQty
mLiftNo = Me.LiftNo
mHold = "On Hold"
mPlan = "Planning"
If mStartQty > 0 Then
If IsNull(mAllocated = DCount("DelTo", "tblEdit", "[LiftNo] Like ""*" & mLiftNo & "*""" & " And [Status] = '" & mHold & "'" & " Or '" & mPlan & "'")) Then
mAllocated = "0"
mNewQty = "0"
Me.AllocatedQty = mAllocated
Me.NewQty = "0"
Else
mAllocated = DCount("DelTo", "tblEdit", "[LiftNo] Like ""*" & mLiftNo & "*""" & " And [Status] = '" & mHold & "'" & " Or '" & mPlan & "'")
mNewQty = mStartQty - mAllocated
Me.AllocatedQty = mAllocated
Me.NewQty = mNewQty
End If
End If