IN THIS TASK
To enable the
ServerFilterByForm property in an Access 2002 run-time environment, you must use the following code snippet.
Me.ServerFilterByForm = True
Me.Refresh
DoCmd.RunCommand acCmdServerFilterByForm
You do not have to have a toolbar with the
ServerFilterByForm button on the form in the run-time application.
Steps to Enable the ServerFilterByForm Property
| 1. | Create an Access project (ADP), and connect to the Pubs database. |
| 2. | Create a new form that is based on the Authors table. |
| 3. | Create a command button with the following code snippet:
Me.ServerFilterByForm = True
Me.Refresh
DoCmd.RunCommand acCmdServerFilterByForm
|
| 4. | Open the form in Form view, and then click the button.
NOTE: The form will still display all of the information for the Authors table, but the ServerFilterByForm button on the toolbar is now enabled. |
| 5. | Before you start the application in a run-time environment, make sure that you set the Startup form. |
| 6. | Create a shortcut that starts the project, and include the /runtime switch in the command line, as follows:
"C:\Program Files\Microsoft Office\Office10\MSACCESS.EXE" "C:\Program Files\Microsoft Office\Office10\Samples\Pubs.adp" /runtime
|
| 7. | Test the database. If you only use DoCmd.RunCommand acCmdServerFilterByForm and do not set the property first, you will receive the following error message:
In the retail version of Access:
Run-time error '2046':
The command or action 'ServerFilterByForm' isn't available now.
In a run-time application:
Execution of this application has stopped due to a run-time error.
The application can't continue and will be shut down.
|
Back to the top
For more information about the ServerFilterByForm property, click
Microsoft Access Help on the
Help menu, type
serverfilterbyform property in the Office Assistant or the Answer Wizard, and then click
Search to view the topic.
Back to the top