over ride query criteria in a report?

  • Thread starter Slez via AccessMonster.com
  • Start date
S

Slez via AccessMonster.com

I have a report based on a query in which the criteria for the field [AwardGC]
is set to "On". It is a Yes/No field. The purpose for it is this: On a
given Project, there may be more than one Customer, referred to in the field
[GCName]. I need the report to show which customer has awarded us the
project. The report functions properly based on this criteria, however...

There are instances where we may need to print the report prior to setting
one of the records to "On", in which case the report comes up with "#Error"
in it's controls. What I would like it to do is to return all the data even
when no GCName has had AwardGC set to "On".

I guess what I'm thinking is that there is some code or expression that would
return data even if the field [AwardGC] is not set to "On" in any of the
records. Sort of an "IIf [AwardGC] = Off, Then [GCName] displays Null"
statement somewhere or in some event. (I know that is probably not even
close, but I hope it makes sense as to what I want to achieve.)

Does this sound like a possibility?
Any help is appreciated!
Slez
 
M

Marshall Barton

Slez said:
I have a report based on a query in which the criteria for the field [AwardGC]
is set to "On". It is a Yes/No field. The purpose for it is this: On a
given Project, there may be more than one Customer, referred to in the field
[GCName]. I need the report to show which customer has awarded us the
project. The report functions properly based on this criteria, however...

There are instances where we may need to print the report prior to setting
one of the records to "On", in which case the report comes up with "#Error"
in it's controls. What I would like it to do is to return all the data even
when no GCName has had AwardGC set to "On".

I guess what I'm thinking is that there is some code or expression that would
return data even if the field [AwardGC] is not set to "On" in any of the
records. Sort of an "IIf [AwardGC] = Off, Then [GCName] displays Null"
statement somewhere or in some event. (I know that is probably not even
close, but I hope it makes sense as to what I want to achieve.)


Unstead of using criteria in the query, use code in form
buttons to open the report. The OpenForm method's
WhereCondition argument can provide the filter.

Code for button to print unfiltered report:
DoCmd.OpenReport "name of report", acViewPreview

Code for button to print filtered report:
Dim stWhere As String
stWhere = "AwardGC = True"
DoCmd.OpenReport "name of report", acViewPreview, _
WhereCondition:= stWhere
 

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