Modal dialog form with filter?

oxfordian3

New member
Local time
Today, 09:23
Joined
Dec 8, 2005
Messages
6
I am working on an Access forms application where the user wants a modal dialog that shows data which has been filtered by the current values in the form which launches the dialog.

It's been hours and I can't get it to work. I don't know how helpful it would be to show any code, but basically I've tried all kinds of combinations of using the DoCmd.OpenForm statement with WindowMode:=acDialog and OpenArgs:= my filter value.

It seems like the cleanest approach is to pass a filter (i.e. keyfield=keyvalue) as OpenArgs, and then in the Form_Load of the modal dialog set it to the form's Filter property. But it never works:

I've tried putting the code in Form_Load, Form_Open, and Form_Activate, because the value doesn't seem to necessarily get accepted in one event or another.

In most cases the .Filter property of the form doesn't accept the new value for some reason. Other times it does apparently accept the new filter value but the form display doesn't reflect the filter. I've tried setting the FilterOn to True, and sometimes this produces an error.

I've also tried using Form.RecordSource set to a SELECT of the table with a WHERE clause equivalent to the Filter.

I found advice at

http://www.pcreview.co.uk/forums/thread-2933674.php

but it didn't work for me.

Does anyone know a good cookbook to get a modal form to filter? Do I need to make sure some form properties are preset? Is there a standard VBA sequence. It should be a pretty frequent thing to do.

thanks,
OX
 
Actually I researched right after I posted and found that I got it to work using the WhereCondition arg of OpenForm.
 

Users who are viewing this thread

Back
Top Bottom