Choosing a printer

B

Bruce

I have recently received some help from this newgroup in
setting up a form and printing the related report. In one
instance I designed a form for entering information, and a
report for printing it. I wanted to print the currently
displayed record only, and somebody sent the following
code, which I attached to a command button on the form.

Private Sub cmdPrintForm_Click()

'Open the report to display only the current record

Dim DocName As String
Dim LinkCriteria As String

stLinkCriteria = "[ID]=" & Me![ID]
stDocName = "rptSpecReview"
DoCmd.OpenReport stDocName, acNormal, , stLinkCriteria

Exit Sub
End Sub

cmdPrintForm is the command button on the form, [ID] is
the autonumber unique identifier for the record, and
rptSpecReview is the report that is printed.
Several questions: This is a very simple database. The
report draws information from a single form, which in turn
is associated with a single table (or query). I have
heard that reports are for printing and forms are for
entering information, but in this case what is the value
of a report that duplicates every field in the form? Any
reason why I shouldn't just print directly from the form,
by use of a Print button on the form?
Assuming there is a reason to have a separate report, the
code above works fine in printing the report on the
default printer. However, different users in different
parts of the facility will be printing this form, and I
would like them to be able to choose a printer. How can
this be done?
I can also set up on the form a button to preview the
report, but when it comes time to print there are some
issues. There is no ready method for putting a Print
button on the report (somebody suggested code to add a
floating toolbar, but that is somewhat cumbersome, and
anyhow I couldn't get it to work). I know the user can
print from a toolbar button, so this is not that big a
concern. However, the print command defaults to printing
all records, and even when Selected Record is checked in
the print dialog, the page numbering is for all of the
records, so that Page 1 of the selected record might show
it as Page 11 of 233 or something.
Ideal situation would be for the user to preview the
reprot for the selected record, then print it with page
numbering such that the first page is always Page 1.
Almost as good is to allow the user to select the printer
within the context of the code above, which produces the
correct page numbering.
 
A

Albert D. Kallal

stLinkCriteria = "[ID]=" & Me![ID]
stDocName = "rptSpecReview"
DoCmd.OpenReport stDocName, acNormal, , stLinkCriteria

You should note that before you launch the report, you need to save the data
in the form to disk BEFORE you launch the report. That report is gong to get
its data from the table, and not the form. So, you need a disk write. Other
wise, any info you enter/change on the form will NOT appear in the report
until you leave and come back tot the report and whack the print button. In
fact, when I launch another form from a existing form, I also as a general
rule do disk write.

So, add the following:
stLinkCriteria = "[ID]=" & Me![ID]
stDocName = "rptSpecReview" Me.Refresh
DoCmd.OpenReport stDocName, acNormal, , stLinkCriteria
Any
reason why I shouldn't just print directly from the form,
by use of a Print button on the form?

Well, you can. However, generally it is pain. You have to deal with things
like background grey printing or not. Often you want a nice page heading and
page number on the report. Perhaps you want the time and date, even perhaps
the report or user name who printed the report. There is just tons of things
that are different, and that you might need for the report, but don't make
sense on the screen. Trying to build a screen that both satisfies and result
in good quality and user friendly input does not result in a nice report. It
is simply two issues you are dealing with.

I have a car, and a lawn tractor. Is there any reason why I should not use
the lawn tractor to give my friends rides to the airport? Hey, if the lawn
tractor works, then use it.

I mean, hey, if printing the form works for you, then go ahead and use it.
However, then don't come crying back here like a little boy when you have
layout problems, control printing problems, and even stuff like page
numbering problems. Using a form is more limited, and generally more of a
pain. This is simply the conclusion of any self respecting developer. If
your
experience is different, the by all means use the form. They are not
designed
for such, but some people would rather use a lawn tractor to drive to the
airport with. I seen people do dishes all day along beside a working
dishwasher. You are free to choose here! Sometimes doing dishes all day
is good for the soul. I can't say that doing dishes all day long
beside a working dishwasher is wrong. I can't say that using a form in
place of a report is wrong either. Whatever works for you.
I
would like them to be able to choose a printer. How can
this be done?

Well, how do they choose a printer in word? How do they choose a printer in
Excel?

How do they choose a printer now? You have to give them the option at some
point. The best solution is to
bring up the report in preview mode.
There is no ready method for putting a Print
button on the report (somebody suggested code to add a
floating toolbar

Well, then don't use a floating toolbar. Use a fixed bar at the top of the
screen. I would also maximize the report preview also. If you watch 243
people open a report, 99% of the time, the first thing the users will do is
maximize the report to see as much as possible. So, then I am sure you by
now
probably always put a maximize command in your report open..right? Why not
do your users a favour, and max the report also! With the report maxed, you
then can have a nice FIXED menu bar at the top of the screen. Well, you
don't have to max the report, and you can still have that menu bar show at
the top of the screen. Remember, virtually all the software you used from
day one for the last 10 years in computers has had menu bar at the top. This
started from windows 3.1, so you might as well join the club!
Ideal situation would be for the user to preview the
reprot for the selected record, then print it with page
numbering such that the first page is always Page 1.

Well, then while previewing the report, you have to give the user two
options:

1) print the report to the dealt printer. So, it is a one click affair, fast
and easy.

2) bring up the printer dialog to allow the user to select the printer.

So, just give the user the two options on a bar at the top of the screen.
From a ease of use, from a user friendliness, it is a slick and easy
solution.

So, I would try the menu bar route, as that works very well. I mean, either
you prompt every time for the printer, or give two options.

I tend to agree with you that giving two options is better then always
prompting for the printer. So, I also like your idea of having two options
to
print, and that is what I have done for years.
 
B

Bruce

Perhaps my question was too wordy, or I tried to cover too
much, but in my original question I think I stated that
the page numbering issues were with the report, not the
form. I would like the user to be sure that the report
looks as it should before printing. The other part of my
question was about allowing the user to select a printer.
I would still like to know if there is a solution there.
While I appreciate the help I have received in this forum,
your condescension is uncalled for. I posted this in the
Getting Started forum because I am, in fact, a relative
beginner to the use of Access. Remarks about "crying like
a little boy" have no place here, and the lawnmower/car
analogy is, at best, a stretch. Perhaps there is a trash-
talking newsgroup somewhere that would be more to your
liking, since it seems that digging a hole under another
person makes you feel bigger.
-----Original Message-----
stLinkCriteria = "[ID]=" & Me![ID]
stDocName = "rptSpecReview"
DoCmd.OpenReport stDocName, acNormal, ,
stLinkCriteria

You should note that before you launch the report, you need to save the data
in the form to disk BEFORE you launch the report. That report is gong to get
its data from the table, and not the form. So, you need a disk write. Other
wise, any info you enter/change on the form will NOT appear in the report
until you leave and come back tot the report and whack the print button. In
fact, when I launch another form from a existing form, I also as a general
rule do disk write.

So, add the following:
stLinkCriteria = "[ID]=" & Me![ID]
stDocName = "rptSpecReview" Me.Refresh
DoCmd.OpenReport stDocName, acNormal, ,
stLinkCriteria
Any
reason why I shouldn't just print directly from the form,
by use of a Print button on the form?

Well, you can. However, generally it is pain. You have to deal with things
like background grey printing or not. Often you want a nice page heading and
page number on the report. Perhaps you want the time and date, even perhaps
the report or user name who printed the report. There is just tons of things
that are different, and that you might need for the report, but don't make
sense on the screen. Trying to build a screen that both satisfies and result
in good quality and user friendly input does not result in a nice report. It
is simply two issues you are dealing with.

I have a car, and a lawn tractor. Is there any reason why I should not use
the lawn tractor to give my friends rides to the airport? Hey, if the lawn
tractor works, then use it.

I mean, hey, if printing the form works for you, then go ahead and use it.
However, then don't come crying back here like a little boy when you have
layout problems, control printing problems, and even stuff like page
numbering problems. Using a form is more limited, and generally more of a
pain. This is simply the conclusion of any self respecting developer. If
your
experience is different, the by all means use the form. They are not
designed
for such, but some people would rather use a lawn tractor to drive to the
airport with. I seen people do dishes all day along beside a working
dishwasher. You are free to choose here! Sometimes doing dishes all day
is good for the soul. I can't say that doing dishes all day long
beside a working dishwasher is wrong. I can't say that using a form in
place of a report is wrong either. Whatever works for you.
I
would like them to be able to choose a printer. How can
this be done?

Well, how do they choose a printer in word? How do they choose a printer in
Excel?

How do they choose a printer now? You have to give them the option at some
point. The best solution is to
bring up the report in preview mode.
There is no ready method for putting a Print
button on the report (somebody suggested code to add a
floating toolbar

Well, then don't use a floating toolbar. Use a fixed bar at the top of the
screen. I would also maximize the report preview also. If you watch 243
people open a report, 99% of the time, the first thing the users will do is
maximize the report to see as much as possible. So, then I am sure you by
now
probably always put a maximize command in your report open..right? Why not
do your users a favour, and max the report also! With the report maxed, you
then can have a nice FIXED menu bar at the top of the screen. Well, you
don't have to max the report, and you can still have that menu bar show at
the top of the screen. Remember, virtually all the software you used from
day one for the last 10 years in computers has had menu bar at the top. This
started from windows 3.1, so you might as well join the club!
Ideal situation would be for the user to preview the
reprot for the selected record, then print it with page
numbering such that the first page is always Page 1.

Well, then while previewing the report, you have to give the user two
options:

1) print the report to the dealt printer. So, it is a one click affair, fast
and easy.

2) bring up the printer dialog to allow the user to select the printer.

So, just give the user the two options on a bar at the top of the screen.
From a ease of use, from a user friendliness, it is a slick and easy
solution.

So, I would try the menu bar route, as that works very well. I mean, either
you prompt every time for the printer, or give two options.

I tend to agree with you that giving two options is better then always
prompting for the printer. So, I also like your idea of having two options
to
print, and that is what I have done for years.


--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.attcanada.net/~kallal.msn





.
 
A

Albert D. Kallal

Right off the bat, I will apologize.

I am sorry Bruce.

Regardless even if I thought my post was a bit tongue in cheek, I will leave
these embellishments out.

It is possible I confused you with another poster who asked about using
forms to print. I mean, once good advice is given, then after a certain
point if the poster insists on continuing with a bad solution and insists on
ignoring sound advice, then there is really not much that can be done. I am
not really sure what to do in those cases when advice is ignored.

However, regardless of what ever issue at stake, I am very sorry, and will
endeavour to NOT embellish my answers in the future. This newsgroup is like
a welcome mat, and any time I do something that makes people feel less
welcome is a big mistake on my part.

So, once again, please accept my apologies here.

Sincerely,
 
B

Bruce

Accepted, and for myself I would also like to express
regret that I felt obliged to react as I did to a
perceived sleight. It is possible that I did post a
similar question in the past, and I thought I understood
the drift of the answer at that time. I did not make it
clear that in this case the difference is that every
single form element would also appear on the report, so in
terms of fields the form and report are identical.
Perhaps, I thought, in this limited circumstance the
report is redundant.
Since I cannot connect to a newsgroup server at work, I
need to use the web site interface. Searching for an old
thread can be difficult, if not impossible. I copy the
answers that I can use again, but sometimes I lose track
of things. More than once I would have liked to go back
to review something about which I thought I was clear, but
later discovered I had more questions. However, sometimes
I have been unable to retrieve the old thread.
Thank you for your prompt and courteous answer to my
irritated remarks. I too will try to keep it a bit
lighter, and try to remember that words alone do not
always convey the full meaning.
 

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