You don't need to use extra quotes if you actually use .., whereClause.
Please don't mislead us with statements like:
DoCmd.OpenReport report,acViewPreview,,[ComputerName] IN ('name1','name2')
when the actual code is:
whereClause = "[ComputerName] IN ('name1','name2')"
DoCmd.OpenReport report,acViewPreview,,whereClause
Have you tried add a debugging line like
Debug.Print whereClause
or
MsgBox "whereClause: " & whereClause
--
Duane Hookom
Microsoft Access MVP
dockeradz said:
The actual line is:
whereClause = "[ComputerName] IN ('name1','name2')"
DoCmd.OpenReport "MachineLabels", acViewPreview, , whereClause
whereClause is constructed by a loop. I have it displayed on the form for
debugging and it looks right, except no enclosing quotes. How could I put
enclosing quotes in the OpenReport statement?
:
Try add quotes around the where condition.
DoCmd.OpenReport report,acViewPreview,,"[ComputerName] IN ('name1','name2')"
--
Duane Hookom
Microsoft Access MVP
:
It is the where condition of course. Here is the line of code:
DoCmd.OpenReport report,acViewPreview,,[ComputerName] IN ('name1','name2')
:
What you have described is not a "query". It might be a Where Condition of
DoCmdOpenReport. Can you provide more code or context to your question?
--
Duane Hookom
Microsoft Access MVP
:
I'm doing a OpenReport for generating labels with the following query:
[ComputerName] IN ('name1','name2')
And I always get whatever is in the first position. Here I would get name1.
I get no errors. What am I doing wrong?