In the following example, the AfterGotFocus event for the Batch ID field checks whether the field is empty when the user moves to it. If it is, the event procedure opens the batch lookup window:
Private Sub BatchID_AfterGotFocus() If BatchID.Empty = True Then 'The field is empty. Press the lookup button LookupButton3 = 1 End If End Sub