Multiple filter

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

Guest

Im opeing a report from a form. Whats wrong with my code. Im trying to only
display the two projects.

DoCmd.OpenReport stDocName, acViewPreview, , "[Project
Name]='Project1,Project2'"
 
You need to specify it as follow

DoCmd.OpenReport stDocName, acViewPreview, , "[Project Name]='Project1' Or
[Project Name] = 'Project2'"

Or, you can
DoCmd.OpenReport stDocName, acViewPreview, , "[Project Name] In ('Project1'
,'Project2')"
 
tanhus said:
Im opeing a report from a form. Whats wrong with my code. Im trying to
only
display the two projects.

DoCmd.OpenReport stDocName, acViewPreview, , "[Project
Name]='Project1,Project2'"

Your syntax for the LinkCriteria is in error. Try:

DoCmd.OpenReport stDocName, acViewPreview, , "[Project Name] = '" &
Me.Project1 & "' OR [Project Name] = ' & Me.Project2 & "'"

If the names of the two projects of interest are in TextBoxes named Project1
and Project2 on the form from whose module you are executing the
DoCmd.OpenReport. If Project1 and Project2 are the actual project names,
then it would be:

DoCmd.OpenReport stDocName, acViewPreview, , "[Project Name] = 'Project1' OR
[Project Name] = 'Project2'"

Larry Linson
Microsoft Access MVP
 
Check the help for "IN clause".
"[Project Name]= IN ('Project1','Project2')"

Edmund
 
oops ... take out the equals.

"[Project Name] IN ('Project1','Project2')"

Edmund said:
Check the help for "IN clause".
"[Project Name]= IN ('Project1','Project2')"

Edmund

tanhus said:
Im opeing a report from a form. Whats wrong with my code. Im trying to
only
display the two projects.

DoCmd.OpenReport stDocName, acViewPreview, , "[Project
Name]='Project1,Project2'"
 
Thanks everyone.

Ofer Cohen said:
You need to specify it as follow

DoCmd.OpenReport stDocName, acViewPreview, , "[Project Name]='Project1' Or
[Project Name] = 'Project2'"

Or, you can
DoCmd.OpenReport stDocName, acViewPreview, , "[Project Name] In ('Project1'
,'Project2')"

--
Good Luck
BS"D


tanhus said:
Im opeing a report from a form. Whats wrong with my code. Im trying to only
display the two projects.

DoCmd.OpenReport stDocName, acViewPreview, , "[Project
Name]='Project1,Project2'"
 

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

Back
Top