I first get a new Bill No. & BillId, I set the gblKeyId=BillId, then I call the frmBill as below.
It runs Form_Open then wait for me to enter data.
when I click the Save button btnSave_Click, it runs to get a next Bill No., append new bill record, then go back to Form_Open.
But when it runs the Me.RecordSource, it steps to IssueDate_LostFocus, then back to the rest after Me.RecordSource.
But when form first display, it does not step to IssueDate_LostFocus.
The textbox IssueDate has Tab Index=0 and Tab Stop=Yes.
Code:Private Sub Form_Open(Cancel As Integer) Me.RecordSource = "SELECT * FROM bill WHERE billId=" & gblKeyId ... End Sub Private Sub IssueDate_LostFocus() Me.ExchRate = GetExchangeRate(Me.IssueDate, Me.CurCode) End Sub Private Sub btnSave_Click() Dim DocNo As String DocNo = NewDocumentNo("Bill") DoCmd.RunCommand acCmdRecordsGoToNew Me.BillNo = DocNo Me.Refresh gblKeyId = Me.BillId Form_Open (0) End Sub