473,385 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Need help with printing a form

Hi All,
A clients database (built by another and not very well but, its what I
have to work with) has bound forms that display customer information
and when printed is three pages long. The information on page 3 is set
to screen display only. When printing it prints 3 pages with the last
page being a blank page. I have tried to surpress the third page by
putting a print button on the form and adding the vba code -
Docmd.Printout acPages, 1, 2 which does Not work.

The Docmd.Printout acPages, 1, 2 actually prints page 1 and 2 of
record 1, not the currently displayed records, which I don't
understand. Again, the form is a bound form and so the user uses the
record selector to go to the record of choice and then wants page 1 and
2 of the displayed record printed.

I have tried several things and can't seem to find the right
combination to get it working correctly, I've tried such things like
Me.Refresh
Docmd.Printout acPages, 1, 2 'print page 1 and 2 of record 1 not
currently displayed record

Me.Requery
Docmd.Printout acPages, 1, 2 'print page 1 and 2 of record 1 not
currently displayed record

DoCmd.RunCommand acCmdSelectRecord
DoCmd.PrintOut acSelection 'still prints third page which is blank

DoCmd.RunCommand acCmdSelectRecord
Docmd.Printout acPages, 1, 2 'print page 1 and 2 of record 1 not
currently displayed record

So, how do I get Only page 1 and 2 of the current record that's being
displayed on the screen printed???

thanks
bobh.

Jun 7 '06 #1
5 2178
print to a report that looks like the form, and set the filter property
to the current record on the open form you're printing from.

Forms are for entering data, not printing. That's part of why you're
having the problem.

Jun 7 '06 #2
Save the form as a report and format the report to print nicely. I have
only very rarely seen it successful to do printing with a form instead of a
report. You'll waste more time trying to pull it off than it could ever
take to do a simple report. And the report will look a hundred times
better.

On your form, add a button, cmdPrintMe. Assuming the txtPrimaryKey is bound
to whatever your primary key field is, you print like this:

docmd.openreport MyNewReport, , , "MyPrimaryKeyField=" & Me.txtPrimaryKey

Just my opinion, of course.
Jun 7 '06 #3

pi********@hotmail.com wrote:
print to a report that looks like the form, and set the filter property
to the current record on the open form you're printing from.

Forms are for entering data, not printing. That's part of why you're
having the problem.


Wish I could but, there are 10 of these forms, each one being very
loaded with controls, I'd have to create 10 reports which I don't
think this client would be willing to pay me for doing.
Thanks
bobh.

Jun 7 '06 #4

Rick Wannall wrote:
Save the form as a report and format the report to print nicely. I have
only very rarely seen it successful to do printing with a form instead of a
report. You'll waste more time trying to pull it off than it could ever
take to do a simple report. And the report will look a hundred times
better.

On your form, add a button, cmdPrintMe. Assuming the txtPrimaryKey is bound
to whatever your primary key field is, you print like this:

docmd.openreport MyNewReport, , , "MyPrimaryKeyField=" & Me.txtPrimaryKey

Just my opinion, of course.


Wish I could but there are 10 different forms which would mean 10
different reports. Unfortunately I can not do one generic report as the
form are that different from each other and I don't think this (new to
me) client would want to pay me to create 10 reports just to surpress a
blank page from printing.
thanks for your suggestion
bobh.

Jun 7 '06 #5
Very likely that he will wind up paying you much more to try to make forms
act like reports, which they are not very good at.
Jun 7 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Chris | last post by:
Hi, I found this code that can solve a problem I have. It sends print direct to printer. Imports System Imports System.Text Imports System.Runtime.InteropServices ...
2
by: Dave | last post by:
How do I hide the buttons when I'm printing a form off? I want the buttons on the form normally but not on the printed version. Another problem I've encountered is how do you get rid of the...
0
by: Tat | last post by:
Hi, I am printing the form. The code is 100% accurate. It is the same as in MSDN, but in C#. ...
5
by: anonymous | last post by:
I'm writing a program that deals extensively with the printer. For the most part my application runs fine, but occasionally I run into some Exceptions. The most common exceptions I run into are...
0
by: Nigel | last post by:
I successfully create a .NET Component (Visual Basic .NET) that would print, unfortunately when used within a web browser it appears that .NET security doesn't allow you to run code that interacts...
0
by: Stephen Muecke | last post by:
The startup form of my application is used to open other forms containing detail information on projects, organisations, employees etc (similar to Outlook) Each detail form has a print method...
2
by: Kevin | last post by:
Is it possible to initiate a form print (in response to a click event) without creating a Printing class? Is there no way inherent in the Forms.Form class to print something out?
1
by: Max | last post by:
Hello, How would you print a picture box? I found sites online on printing a form and its basic controls but nothing on picture boxes. Is it possible to print a logo for example from a C# .NET...
0
it0ny
by: it0ny | last post by:
Hi guys, thanks I am fairly new to this forum so I hope I chose the right place to post this question. I try to make my program printout a deposit's report. I created a class to store the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.