Examples: BeforeGotFocus event

In the following example, the procedure checks whether the document type is a return. If so, this procedure cancels the VBA AfterGotFocus event procedure, which automatically opens a lookup window for the Batch ID field:

Private Sub BatchID_BeforeGotFocus(CancelLogic As Boolean)
	If DocumentType = 7 Then
		'The document type is a return. Don’t use a batch
		BatchID.Empty = True
		'Cancel the VBA AfterGotFocus event, which opens a lookup
		CancelLogic = True
		MsgBox "Post returns individually, not in a batch."
	End If
End Sub

Documentation Feedback