Print single record from report

G

Guest

Steve,

Thanks. the unique values fixed the problem. I now have 2 more questions
for you. I apologize for needing all the help, but I am really enjoying
learning HOW MUCH YOU CAN DO WITH ACCESS.

So here is my question:

I have 2 reports that are generated from 1 form. On this form, a supervisor
has 3 options for each record (agree, disagree, or addendum). The first
report shows every record that was edited in that session (agrees, disagrees,
or addendums). The second report shows every record that was has either
disagree or addendum (query criteria = >1). This generates the reports
great, however, if none of the records have disagree or addendum then I don't
need the second report and as it is right now I print a blank report every
time. I think what I need is an If statement, but I don't know where to
enter it. Something like If all active records [AttendingCheckout]=1 Then
don't open report. I'm not sure how to do this. My other question is that
if this is possible to do, can I make these 2 reports print out on 2 seperate
printers via the same macro? Currently all of my reports that print are
automatically sent to the default printer. Is there a way to choose for 1 of
the reports to go to a different printer?

Thanks


Steve Schapel said:
Brandon,

"Parameter" has a different meaning. What you are referring to here are
Criteria.

In design view of the query, if you select SQL from the View menu, this
will show you the SQL view of the query - can you then copy/paste it
into your reply? Thanks. What you have done with the criteria seems
correct, but I can not see so far why you are getting replicated records
returned.

However, this may fix it... in the design view of the query, right-click
anywhere on the background of the upper panel of the query design
window, and then select Properties from the pop-up menu. Set the Unique
Values property to Yes.

By the way, 'date' is a "Reserved Word" (i.e. has a special meaning) in
Access, and as such should not be used as the name of a field.

--
Steve Schapel, Microsoft Access MVP
I'm not sure what you mean by the SQL view, but this is copied out of the
parameter field in my query: I have 3 parameters in the query:

1) In the field title [Date] (to pull records in the past 10 days):
Date()-10

2) I also have a parameter in a yes/no field (checkbox) to pull any records
that are yes (checked box):

<>0

3) Lastly, I have a parameter in a field to pull types of exams (1, 2, 3,
or 4 possible)
I only want 1 or 4:

1 Or 4

I want to select all records from the table that have a checked box, are of
exam type 1 or 4, and have been entered in the past 10 days. Where am I
going wrong? If there is a better way for me to post this message let me know
and I will do it.
\
 
S

Steve Schapel

Brandon,

See comments inline below...
Thanks. the unique values fixed the problem. I now have 2 more questions
for you. I apologize for needing all the help, but I am really enjoying
learning HOW MUCH YOU CAN DO WITH ACCESS.

In this regard, you might enjoy looking through some of this...
http://accesstips.datamanagementsolutions.biz/apps.htm
... however, if none of the records have disagree or addendum then I don't
need the second report and as it is right now I print a blank report every
time. I think what I need is an If statement, but I don't know where to
enter it. Something like If all active records [AttendingCheckout]=1 Then
don't open report. I'm not sure how to do this.

I assume you are using an OpenReport action in your macro. In the
Condition column of the macro, for this OpenReport action, put the
equivalent of this...
DCount("*","YourQuery")>0
.... where YourQuery is the name of the query that the report is based on.
If you can't see a Conditions column in the macro design window, select
it from the View menu.
... can I make these 2 reports print out on 2 seperate
printers via the same macro? Currently all of my reports that print are
automatically sent to the default printer. Is there a way to choose for 1 of
the reports to go to a different printer?

In design view of the report, go to the File|Page Setup menu, on the
Page tab select the 'Specific Printer' option, and enter the name of the
printer you want the report to use. This assumes you are talking about
two separate reports. If you mean the same report, being printed out
with different criteria, then as far as I know this is beyond the scope
of what can be done in a macro - but it can be done with VBA code, the
instructions for which will depend on which version of Access you are
using. Some good information under 'printer change code' here:
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
 

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