1. In form design view, add a command button to your form, and set these
properties:
Name cmdFilterBySelection
On Click [Event Procedure]
2. Click the Build button beside the On Click property.
Access opens the code window.
Set up the code as follows:
Private Sub cmdFilterBySelection_Click()
On Error GoTo Err_Handler
Screen.PreviousControl.SetFocus
RunCommand acCmdFilterBySelection
Exit_Handler:
Exit Sub
Err_Handler:
MsgBox "Error " & Err.Number & ": " & Err.Description
Resume Exit_Handler
End Sub
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
morgan said:
I'd like to create a "filter by selection" button on a form with exactly
the
same function of the one on the toolbar. I'm using Access 2002. Please
make
the explanation as simple as possible. I'm a newbie and I don't know SQL.
Thanks in advance