Use Macro to Filter records in Subform on open

R

RickSF

I have a Subform that I want to show specific records when I open its main
form via a macro. After opening the form with the OpenForm command, I use
the ApplyFilter command with this Where condition:

[Forms]![BudSpendTransit]![BudSpendTransitSub
Subform].[Form]![BudSpendDetail0QTr]![CashFlowMM]=[CurrMMYY]

The control source for the Subform is the query called "BudSpendDetail0QTr"
containing both the CashFlowMM and CurrMMYY fields.

(The macro's Filter Source is left blank, otherwise the fields of the query
go into the Condition of the main form which does not contain any of the
query's fields.)

The result is records from the prior MM/YY not the current MM/YY. For
example, I get the 12/09 records, not the 01/10 records.

What is the correct syntax to filter records in a subform via a macro?

Thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top