calling a report from a form

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
 
D

Douglas J. Steele

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.
 

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