Filter Report Base On form query/filter with LIKE * (1 Viewer)

bignose2

Registered User.
Local time
Today, 01:04
Joined
May 2, 2010
Messages
219
Hi,

I have a form that is filtered using a query & applyfilter.
I want to use the same filter for report (to match the same to print)

DoCmd.ApplyFilter "EmailPasteSearch"
The form is filtered perfectly as expected.

in the EmailPasteSearch Query the criteria is
Like "*" & [Forms]![EmailPasteList]![SearchMain] & "*"

If try I use the filter for a report it does not filter at all.
in the Reports OnOpen
Me.Filter = Forms![EmailPasteList].Filter
Me.FilterOn = True

I can see that the report.filter is literal & not using the value.
Debug.print shows me.filter as
((((EmailPaste.Subject) Like "*" & [Forms]![EmailPasteList]![SearchMain] & "*")) OR (((EmailPaste.Email) Like "*" & [Forms]![EmailPasteList]![SearchMain] & "*")) OR (((EmailPaste.Surname) Like "*" & [Forms]![EmailPasteList]![SearchMain] & "*")) OR (((EmailPaste.PetNames) Like "*" & [Forms]![EmailPasteList]![SearchMain] & "*")) OR (((EmailPaste.Breed) Like "*" & [Forms]![EmailPasteList]![SearchMain] & "*")))

I assume at this point is should actually be Like "*" & 'Jones' & "*"

As it filters the form ok I am a bit confused.

I tried using ' instead of "

I am guessing I have to copy the SQL above & adjust with more " & ''a etc but had rather hoped the query (or straight copy of the query) would work

I think I am missing something fundamental here.

Taking it one step further I'm sure it needs more quotes & perhaps '", I can work that out but instead I have a variety of different filters that get applied on this same form. So rather than copy one query I would either like to auto manipulate the form filter string on the fly or find a better way.
Basically on the same form I have the same problem with ([tNoPoint] = False) AND ([tNotFound] = True) not working. Again using me.filter. I thought this should work as simple boolean. Not sure what this should look like actually. Again works on the form but not to a report. These are check boxes on the report.


thanks I/A
 
Last edited:

bignose2

Registered User.
Local time
Today, 01:04
Joined
May 2, 2010
Messages
219
SOLVED:
really weird, working now, PC restart & lots of compacting & working.
Have not change anything.
I compact pretty much every time if compile so very surprised.
 

Users who are viewing this thread

Top Bottom