Ray, you are right. It worked with that db.
But when I applied the code to my real db, with a few tables and queries to inner join are put in the Record Source, something changed. I really don't know whether it is query or parameter changes.
Can you look into the code below? (the last few lines), it showed error right at Employer.SetFocus
Option Compare Database
Private Sub Command9_Click()
Call Employee_Modules.open_window(Me, "Emp_Window", "[Emp ID]", Me![Dept ID])
End Sub
Private Sub Contract_Number_Enter()
Me.Command9.SetFocus
End Sub
Private Sub Delivery_Order_Number_Enter()
Me.Command9.SetFocus
End Sub
Private Sub Command10_Click()
On Error GoTo Err_Command10_Click
DoCmd.close
Exit_Command10_Click:
Exit Sub
Err_Command10_Click:
MsgBox Err.Description
Resume Exit_Command10_Click
End Sub
Private Sub Form_Open(Cancel As Integer)
Me.Command18.Visible = False
Me.Command17.Visible = True
On Error GoTo Err_form_open
Me.Text11.value = "ACTIVE EMP for " & [Forms]![Employer List]![Employer]
Me.Text19.value = "EMP for " & [Forms]![Employer List]![Employer]
Me.FilterOn = True
Exit_Form_Open:
Exit Sub
Err_form_open:
Me.Text11.value = "ACTIVE EMP"
Me.Text19.value = "EMPLOYEES"
Me.FilterOn = True
Resume Exit_Form_Open
End Sub
Private Sub Command14_Click()
Call FACTS_Modules.open_window(Me, "Emp_Window", "", "")
DoCmd.GoToRecord , , acNewRec
End Sub
Private Sub Command18_Click()
Dim temp As String
temp = Me.Filter
Me.Filter = Nz(Me.Text16, "")
Me.Text16 = temp
Me.FilterOn = True
Me.Command10.SetFocus
Me.Command18.Visible = False
Me.Command17.Visible = True
Me.Text11 = "ACTIVE " & Me.Text19.value
End Sub
Private Sub Command17_Click()
Dim temp As String
temp = Me.Filter
Me.Filter = Nz(Me.Text16, "")
Me.Text16 = temp
Me.FilterOn = True
Me.Command10.SetFocus
Me.Command17.Visible = False
Me.Command18.Visible = True
Me.Text11 = "ALL " & Me.Text19.value
End Sub
Private Sub Label29_Click()
[Emp Number].SetFocus
DoCmd.RunCommand acCmdSortAscending
End Sub
Private Sub lblEmployer_Click()
Employer.SetFocus
DoCmd.RunCommand acCmdSortAscending
End Sub