A
AccessIM
I have a command button on a form with the following code in the On Click
procedure:
Private Sub Command15_Click()
On Error GoTo Err_Command15_Click
Me![LastName].SetFocus
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Command15_Click:
Exit Sub
Err_Command15_Click:
MsgBox Err.Description
Resume Exit_Command15_Click
End Sub
I set the focus on the Last Name so the user could search for an employee by
the last name without having to click the cursor in the last name field.
The problem is that, when the user doesn't know how to spell the last name
exactly, they key in a portion of the name and change the Match field to "Any
Part of Field". When they do this, Access searches and stops on all fields
containing the criteria they entered and not just in the Last Name field.
Is there a way to keep the focus in the Last Name field so that it doesn't
search other fields (like the department field, etc.)?
procedure:
Private Sub Command15_Click()
On Error GoTo Err_Command15_Click
Me![LastName].SetFocus
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Command15_Click:
Exit Sub
Err_Command15_Click:
MsgBox Err.Description
Resume Exit_Command15_Click
End Sub
I set the focus on the Last Name so the user could search for an employee by
the last name without having to click the cursor in the last name field.
The problem is that, when the user doesn't know how to spell the last name
exactly, they key in a portion of the name and change the Match field to "Any
Part of Field". When they do this, Access searches and stops on all fields
containing the criteria they entered and not just in the Last Name field.
Is there a way to keep the focus in the Last Name field so that it doesn't
search other fields (like the department field, etc.)?