AccessAdp.com

the BEST resource for information about Microsoft Access and SQL Server

Forms


Where and Filter Clause do not work when using DoCmd.OpenForm Statement
One of the issues you will find when working with an Access Data Project, (ADP), is the lack of functionality in the Where and Filter clause of the DoCmd.OpenForm statement, they don’t work with ADPs. There are two techniques you can use to overcome this limitation:

Set The Form’s Record Source Property
On startup or during the course of using the form, you can set the form’s record source property using the OpenArgs argument:
Me.RecordSource = “Select * from MyTable Where ” & Me.OpenArgs

Use ServerFilter Property
Another method is to use the ServerFilter property of the form. On the open event you will need to use the following statements
Me.ServerFilter = “”
Me.ServerFilter = Me.OpenArgs
The first line is needed to reset the property before you set it to something else.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 337 other followers