Okay, I have this figured out for you. You will have to make a few updates to the code to reflect form control names but it shouldn't be too difficult. The following is the VBA code for the Filter_By_Selection Command Button:
Private Sub Filter_By_Selection_Click()
On Error GoTo Err_Filter_By_Selection_Click
Dim ctlPrevious As Control
' No previous control error.
Const conNoPreviousControl = 2483
Set ctlPrevious = Screen.PreviousControl
ctlPrevious.SetFocus
DoCmd.RunCommand acCmdFilterBySelection
Exit_Filter_By_Selection_Click:
Exit Sub
Err_Filter_By_Selection_Click:
MsgBox Err.Description
Resume Exit_Filter_By_Selection_Click
End Sub
This VBA code is for the Clear_Filter command Buttons On Click Event Procedure:
Private Sub Clear_Filter_Click()
DoCmd.RunCommand acCmdRemoveFilterSort
End Sub
The following is a must for this to work. You see the Screen.PreviousControl command only works after the focus has moved to two or more controls on the form after it is opened. So, you have to put two control.setfocus commands into the On Open Event Procedure of the form. Just pick a controlname and for the first one and then the second one should be the control that has the first tabstop so that you form looks like it is opening naturally. Then the command buttons will work.
me![ControlName1].setfocus
me![Controlname2].setfocus
Let me know if you need more assistance setting this up. Bob Scriver