Docmd applyfilter

K

KarenH

I am trying to fun a query based on something a user selects from a listbox,
and I am trying to use ApplyFilter to set that criteria.

I have the following code:

DoCmd.ApplyFilter , "[BU] = '" & strBUFilter & "'"
DoCmd.OpenQuery gstrQueryNameSelected

The query has been assigned to the gstrQueryNameSelected variable, and
strBUFilter is set to the BU selected from the list.

I get the following error: "The action or method is invalid because the
form or report isn't bound to a table or query." I tried putting the
applyfilter statement after the openquery statement, and got the same error
message.

What am I doing wrong? Thanks in advance.
 

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