Get rid of the square brackets []. They're only required when you want to
put the name of a field inside, not a literal value.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Frank" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I have a search from where it calls a report. Depending on the search word
> it filters the records in the report. How can I pass the value of the text
> box to the OpenReport command. Here are the lines I am trying to run:
> strToSearch = txtSearch.Value
> strWhereClause = "(((StrComp(Left(Products.ProductName,Len([" &
> strToSearch & "])),[" & strToSearch & "]))=0))"
> DoCmd.OpenReport "Generic Name Search Report", acViewPreview, ,
> strWhereClause
> Thank you.
>
> Frank
>
>