I'm using the On Change Event for the Quantity Field. The code I'm attempting to execute is as follows:
Private Sub QUANTITY_Change()
Dim lngInvItemID As Long, lngPOItemID As Long, lngQuantity As Long
Dim receivedqtytest As Long
Dim rst As Recordset
Dim qtytest As Long
qtytest = Me.QUANTITY.Value
lngInvItemID = Me.ItemID
lngPOItemID = Me.POItemID
lngQuantity = Nz(Me.QUANTITY, 0)
'check that user did not move focus on subform to different po item than what is on the invoice screen
If Me.POItemID <> Me.sbfPO_List_Box_Items.Form.ItemID Then
Set rst = Me.sbfPO_List_Box_Items.Form.Recordset
rst.FindFirst "[ItemID] = " & lngPOItemID
End If
Me.sbfPO_List_Box_Items.Form.ReceivedAmt = UpdateReceivedQuantity(lngInvItemID, lngPOItemID, lngQuantity)
receivedqtytest = Me.sbfPO_List_Box_Items.Form.ReceivedAmt
If Me.sbfPO_List_Box_Items.Form.ReceivedAmt >= Me.sbfPO_List_Box_Items.Form.QUANTITY Then
Me.sbfPO_List_Box_Items.Form.Received = True
Else
Me.sbfPO_List_Box_Items.Form.Received = False
End If
Me.FREIGHT.SetFocus
Me.InvoiceTotal.Requery
Me.txtNewInvoiceTotalFreight.Requery
The problem I'm having is the value I want to use for lngQuantity is the changed value. The value the code is currently using is the original value. How do I retrieve the changed value for the quantity field for use in these calculations?
Thank you.