aron.ridgway
Registered User.
- Local time
- Today, 18:19
- Joined
- Apr 1, 2014
- Messages
- 148
Im trying to create a record set that compares a quantity value in the recordset to a Value in a temporary table that holds the most recent remaining quantity. I have the following code in the after update of a text box, but it does not trigger. I want it to run after a value is entered into the text box. Is the code wrong or the location im putting it incorrect?
Code:
Private Sub txtQty_AfterUpdate()
Dim rs As DAO.Recordset
DoCmd.OpenQuery "qryQuantitySoFar"
Set rs = Forms!frmReceive!sfrmReceiveDetailEntry.Form.RecordsetClone
With rs
Do While Not rs.EOF
If rs("Qty") > Nz(DLookup("[RemainingQty]", "tblQtySoFarTEMP", "[OrderDetailPK]= " & rs![OrderDetailFK])) Then
MsgBox "The Quantity received is greater than the outstanding quantity? Would you like to update the original order quantity?"
End If
rs.MoveNext
Loop
End With
Set rs = Nothing
End Sub