Your process is a little confusing.... Are you changing the record source of Form B each time the button is clicked? (I never have liked doing that)
Try this:
On FormA, add a button with this code in the click event:
Code:
Private Sub OpenFormB_Click()
On Error GoTo Err_OpenFormB_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim strOpenArgs As String
stDocName = "FormB"
'change [EmpId] and [ID] to your field names
' [EmpID] is in FormB
'[ID} is in FormA
stLinkCriteria = "[EmpID]= " & Me![ID]
strOpenArgs = Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , strOpenArgs
Exit_OpenFormB_Click:
Exit Sub
Err_OpenFormB_Click:
MsgBox Err.Description
Resume Exit_OpenFormB_Click
End Sub
In FormB, put this code in the load event:
Code:
Private Sub Form_Load()
Dim tmp As Boolean
tmp = Me.NewRecord
If tmp Then
'change [EmpID] to your field name
Me.EmpID = Me.OpenArgs
End If
End Sub
When the button on FormA is clicked, FormB is opened with a filter. If there are no matching records, the current record will be a new record. The Load event checks if it is at the new record and adds the open argument data to the matching field.