calling a report from a form

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

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
 
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.
 
Back
Top