Printing a report

G

Guest

Hi, I'm desesperate, I start to learn acces 1 month ago, and I have been
learning a lot, but I found that is an impossible program, I need to make a
program and my boss told me that I make it in acces rather than in excel, so
I really need to finish this program,
ok, what I want to do is:
I have a form, when I press a button the print preview report page appears,
(until here everithing is done) my problem is when I want to print just the
page shown, when I put print the whole report (with is 1232 pages) is print,
and I just want to print the visible page (one page) someone send me this:

Dim strDocName As String
Dim strWhere As String
strDocName = "rptSomeReport"
strWhere = "[RunID]=" & me!RunID
DoCmd.OpenReport strDocName, acPreview, , strWhere

But as I have never used acces before, I didn't understand a word
what can I do???
 
L

Larry Daugherty

I guess you haven't bothered to read and understand the answer posted here
that I'd already answered you in Microsoft.public.gettingstarted. I've just
added that newsgroup so you can see how it is done. Go read the message in
the other newsgroup. Don't get so desperate and panicky that you are
unable to take in information. :)

I pasted in a subroutine from one of my old applications in the other thread
but the gist of it is the same as the code you have posted here. I'll make
my comments next to the relevant code below.





filo666 said:
Hi, I'm desesperate, I start to learn acces 1 month ago, and I have been
learning a lot, but I found that is an impossible program, I need to make a
program and my boss told me that I make it in acces rather than in excel, so
I really need to finish this program,
ok, what I want to do is:
I have a form, when I press a button the print preview report page appears,
(until here everithing is done) my problem is when I want to print just the
page shown, when I put print the whole report (with is 1232 pages) is print,
and I just want to print the visible page (one page) someone send me this:

Dim strDocName As String
Dim strWhere As String
strDocName = "rptSomeReport"

rptSomeReport should be the name of the report you have already
designed.

strWhere = "[RunID]=" & me!RunID

RunID must be the Primary Key of the table on which the record is
based.
me!RunID refers to a textbox control that has the value of the
Primary Key for this record
DoCmd.OpenReport strDocName, acPreview, , strWhere

The above command opens the report whose name is in strDocName in
Print Preview mode and will print just the record whose Primary Key value is
in this form's textbox named RunID.
But as I have never used acces before, I didn't understand a word
what can I do???
You might explain to your boss that Access has a much steeper learning
curve than Excel. It may well take you two or three months to cobble
together some barely workable solution when you are starting out that you
will later be able to build in a day. Believe me it's better to explain it
to him now and save yourself the gut churning anxiety you seem to be
experiencing. You need some applied learning time. If s/he is reasonable,
you'll get it. Probably neither of you knew how steep the learning curve
would be. I'll give you a few outrageous examples:

1 You have been given a complete automotive engineering and maintenance
shop and a brand new Ferrari that is badly out of tune. You are told you
had to have it in perfect running order before sundown but you are not given
training nor onsite help.

2 You are placed aboard a 50 foot gaff rigged ketch.all sails and lines
aboard, stocked with plenty of fuel, food and water, charts and navigational
aids. No training nor personal help allowed. Sail around the world alone;
starting now.

3 You are told to do the same application in Access that you already have
done in Excel. Your boss thinks it should be easy because those Access
tables sure look like Excel spreadsheets. There is no comparison between
the two each is excellent at what it does: Excel primarily in the sphere of
calculations, Access primarily in the sphere of data management.

If there is a great deal of urgency about having a fully working and
debugged application you may get the boss to consider hiring a consultant.

Post again as questions arise.


by the way, how coincidental is your signature name: "Filo" means love and
666 is the number of the beast, i.e. Satan. Whassup?

HTH
 

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