ACCESS EXPERTS

FOR HELP WITH YOUR ACCESS DATABASES, INCLUDING SQL SERVER, WE ARE JUST ONE CLICK AWAY...


Tuesday, July 13, 2010

Part 1 Access ADP Tip: Using ADP ServerFilter property

Note: This is part one of a series of articles on Access ADP projects, to see the complete list and other articles please click here.

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.

No comments:

Post a Comment