Apply Filter Problem

J

James

Hello I have tried this:

DoCmd.ApplyFilter , "Title Like '*" & Me.txtTitle.Value
& "*'"
DoCmd.ApplyFilter , "SubTitle Like '*" & Me.txtTitle.Value
& "*'"

And It Filters the SubTitle but not the Title...

How can I get it to filter from two rows?

Many Thanks

James
 
K

Ken Snell

Combine them into one statement:

DoCmd.ApplyFilter , "Title Like '*" & Me.txtTitle.Value _
& "*' And SubTitle Like '*" & Me.txtTitle.Value & "*'"
 
J

James

I have put this code in and it dosent apply the filter at
all now...

What could be wrong?

James
 
K

Ken Snell

When you say it's not applying the filter at all, you mean nothing is
happening? Or that it's not displaying the records that you expect?

Your original post said "How can I get it to filter from two rows?". By
this, are you wanting to use two different values for the Title value and
for the SubTitle value? The code that you presented is using the same value
for both?
 
J

James

Ok no need to persue with this I have solved the error...

DoCmd.ApplyFilter , "Title Like '*" & Me.txtTitle.Value
& "*' OR SubTitle Like '*" & Me.txtTitle.Value & "*'"

That is what I needed an OR rather than an AND...

Ah well

Thanks for you assistance...

James
 

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