Need Help w/ApplyFilter + Query

E

egun

I have this line in a VBA module:

DoCmd.ApplyFilter Get_WBS_String_Query

which is supposed to filter all the records in my database by the WBS field.
The user clicks on one of several checkboxes on the main form to select
which WBS to filter, and then the VBA code is run to filter the records.

The "Get_WBS_String_Query" is a query whose SQL looks like this:

SELECT tlkpWBS.WBS, [MyParam] AS Expr1
FROM DATATABLE INNER JOIN tlkpWBS ON DATATABLE.[Primary WBS] = tlkpWBS.ID
WHERE (((tlkpWBS.WBS) Like [MyParam]));

When I run the query manually, it requests the parameter, and I enter
something like "11*", and it will correctly filter WBS for all items starting
with "11". I need to be able to supply the query parameter in the VBA code,
but don't know how.

Is this a good way to do this? Any better ideas? Some of the queries are
complex (such as wanting to include all items starting with "1", but
excluding "14*" and "16*").

Thanks in advance,

Eric
 

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

Similar Threads

Why Doesn't My SQL Work 3
Applyfilter issue 3
Quirky Query 4
Usind the Option Group Function 1
Using Check boxes 6
Need Help Filtering a Form with VBA 2
ApplyFilter with VBA 4
applyfilter with a wildcard 1

Top