Filter on Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using Access 2003. I'm trying to pass a filter via code to a subform and
it is not working.

I've searched similar issues in the Newsgroups and have found that the
answers provided seem to have worked for those people, but they DO NOT WORK
FOR ME. I have no idea why.

Even when I type in the text manually it doesn't work. Ex: [Subject] =
"Smith".

Here is what I'm passing via code:
strSQL = [Subject] like '*Smith*' or [Subject] like '*Jones*'
Forms!frmMain!sfrmSearches.Form.Filter = strSQL

Then I do the me.filteron = true. But it doesn't matter because it doesn't
work.

Please help. Thanks.
 
What's in strSQL needs to be a string. In other words, you need quotes
around it:

strSQL = "[Subject] like '*Smith*' or [Subject] like '*Jones*'"
 
Douglas:

Belated thanks.

--
Craig


Douglas J. Steele said:
What's in strSQL needs to be a string. In other words, you need quotes
around it:

strSQL = "[Subject] like '*Smith*' or [Subject] like '*Jones*'"


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Craig said:
I'm using Access 2003. I'm trying to pass a filter via code to a subform
and
it is not working.

I've searched similar issues in the Newsgroups and have found that the
answers provided seem to have worked for those people, but they DO NOT
WORK
FOR ME. I have no idea why.

Even when I type in the text manually it doesn't work. Ex: [Subject] =
"Smith".

Here is what I'm passing via code:
strSQL = [Subject] like '*Smith*' or [Subject] like '*Jones*'
Forms!frmMain!sfrmSearches.Form.Filter = strSQL

Then I do the me.filteron = true. But it doesn't matter because it
doesn't
work.

Please help. Thanks.
 
Back
Top