I have a form based upon a query.
Field next to Search Employee is named Search_Lname and is unbound, with On Lost Focus property calling:
Private Sub Search_Lname_LostFocus()
If Search_LName <> "" Then
Query = "SELECT * FROM Employees WHERE (([Employees].[LName])=[Forms].[ChangeEmployeeData].[Search_Lname])"
Me.RecordSource = Query
Me.Refresh
Else
On Error GoTo TestMacro_Err
DoCmd.GoToRecord , "", acNewRec
TestMacro_Exit:
Exit Sub
TestMacro_Err:
MsgBox Error$
Resume TestMacro_Exit
MsgBox ("You have entered a blank")
End If
End Sub
------------------------------------------------------------------
The "Current Employees" and "Released Employees" buttons call Reports. The search function works well (finally... took a while!).
I would like the cursor to appear in the Search_Lname field when opening the form. To do this I change the tab order. However whenever I change the tab order, I can no longer edit any record in the form (in Form View), and I can no longer scroll between different records that satisfy the search criteria (i.e. 3 people with same last names). Basically, when I change the tab order the form locks. If I change the tab order back to Auto Order, it all works fine again.
Please advise if anyone has seen this behavior, and how I might fix it. Thanks in advance!
Field next to Search Employee is named Search_Lname and is unbound, with On Lost Focus property calling:
Private Sub Search_Lname_LostFocus()
If Search_LName <> "" Then
Query = "SELECT * FROM Employees WHERE (([Employees].[LName])=[Forms].[ChangeEmployeeData].[Search_Lname])"
Me.RecordSource = Query
Me.Refresh
Else
On Error GoTo TestMacro_Err
DoCmd.GoToRecord , "", acNewRec
TestMacro_Exit:
Exit Sub
TestMacro_Err:
MsgBox Error$
Resume TestMacro_Exit
MsgBox ("You have entered a blank")
End If
End Sub
------------------------------------------------------------------
The "Current Employees" and "Released Employees" buttons call Reports. The search function works well (finally... took a while!).
I would like the cursor to appear in the Search_Lname field when opening the form. To do this I change the tab order. However whenever I change the tab order, I can no longer edit any record in the form (in Form View), and I can no longer scroll between different records that satisfy the search criteria (i.e. 3 people with same last names). Basically, when I change the tab order the form locks. If I change the tab order back to Auto Order, it all works fine again.
Please advise if anyone has seen this behavior, and how I might fix it. Thanks in advance!