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
 
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'"
 
Back
Top