OpenReport - the WHERE clause

G

Guest

I am trying to create a report that shows information on people assigned to
projects. They can be assigned either as the Assignee or as the Originator of
the project. I have one query that contains the project info (including both
the Assignee and Originator fields). The report is opened from a switchboard,
and the user selects a name from a drop-down list.

Previously, I just wanted the report to show the projects for which the
selected person is the Assignee - that worked great, and my code was as
follows:

DoCmd.OpenReport "Workload", acViewPreview, , "Assignee = '" &
Me!cboAssignee & "'"

Now that I also want to show the projects for which the selected person is
the Originator, I'm thinking I just need an OR statement at the
end...something like this:

DoCmd.OpenReport "Workload", acViewPreview, , "Assignee = '" &
Me!cboAssignee & "'" Or "Originator = '" & Me!cboAssignee & "'"

However, when I try to run this I get a type mismatch error. Ack!

Any suggestions? Can I not use the OR with the WHERE statement in the
OpenReport method?
 
G

Guest

That yours
DoCmd.OpenReport "Workload", acViewPreview, , "Assignee = '" &
Me!cboAssignee & "'" Or "Originator = '" & Me!cboAssignee & "'"

Try this
DoCmd.OpenReport "Workload", acViewPreview, , "Assignee = '" &
Me!cboAssignee & "' Or Originator = '" & Me!cboAssignee & "'"

compare the two and youll see you had ann extra "
 
G

Guest

Thanks Ofer - worked like a charm. I see where my problem was. One of those
"duh" moments!! :)
 

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