Preview or print different reports from the same query

G

George R

The following code does not produce any records in the report.

DoCmd.OpenReport "rptQuitDeclineList", acViewPreview, "qryQuit_DeclineList",
Resident = True, acWindowNormal, "Residents Only"

The problem is in the "Where" clause: "Resident = True". If I leave it out,
I get the complete list of those who quit or declined, so the rest of the
code seems OK.
I have tried "[Resident] = True" and "[tblOwners].[Resident] = True" and
"[qryQuitDeclineList].[Resident] = True" without success. I have also tried
all these without the square brackets without success.

Can anyone tell me the proper syntax?
Thanks for your consideration.
 
D

Duane Hookom

What happens if you try:
DoCmd.OpenReport "rptQuitDeclineList", acViewPreview, ,"Resident = True",
acWindowNormal, "Residents Only"
 
G

George R

Thanks, Duane. that worked fine.
Also, in continuing to experiment, I found that the following would also work:
DoCmd.OpenReport "rptQuitDeclineList", acViewPreview, ,"[Resident] =" & True,
acWindowNormal, "Residents Only"
Duane Hookom said:
What happens if you try:
DoCmd.OpenReport "rptQuitDeclineList", acViewPreview, ,"Resident = True",
acWindowNormal, "Residents Only"


--
Duane Hookom
MS Access MVP


George R said:
The following code does not produce any records in the report.

DoCmd.OpenReport "rptQuitDeclineList", acViewPreview,
"qryQuit_DeclineList",
Resident = True, acWindowNormal, "Residents Only"

The problem is in the "Where" clause: "Resident = True". If I leave it
out,
I get the complete list of those who quit or declined, so the rest of the
code seems OK.
I have tried "[Resident] = True" and "[tblOwners].[Resident] = True" and
"[qryQuitDeclineList].[Resident] = True" without success. I have also
tried
all these without the square brackets without success.

Can anyone tell me the proper syntax?
Thanks for your consideration.
 

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