When the user enters a transaction amount in the Receivables Transaction Entry window, the following event procedure compares the amount with the maximum batch total in an invisible Receivables Batch Entry window:
Private Sub SalesAmount_BeforeUserChanged(KeepFocus As Boolean, _ CancelLogic As Boolean) If BatchID.Empty = False Then 'Open the Batch Entry window invisibly ExpansionButtons = 1 ReceivablesBatchEntry.Visible = False 'Compare the batch total to the transaction amount entered If CCur(SalesAmount)>CCur(ReceivablesBatchEntry _ .BatchTotal) Then MsgBox "Amount exceeds batch limit." 'Clear the batch ID field and move the focus there BatchID.Empty = True BatchID.Focus End If 'Close the window ReceivablesBatchEntry.Close End If End Sub