473,779 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.RunComman d acCmdSelectReco rd
DoCmd.PrintOut acSelection 'still prints third page which is blank

DoCmd.RunComman d acCmdSelectReco rd
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 2215
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.openrepor t MyNewReport, , , "MyPrimaryKeyFi eld=" & Me.txtPrimaryKe y

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

pi********@hotm ail.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.openrepor t MyNewReport, , , "MyPrimaryKeyFi eld=" & Me.txtPrimaryKe y

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
2219
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 <StructLayout(LayoutKind.Sequential)> _ Public Structure DOCINFO<MarshalAs(UnmanagedType.LPWStr)>
2
1979
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 record navigation bar at the bottom of the form?
0
1338
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#. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vbcode/html/vbtskCodeExamplePrintingForm.asp What happens is that if during printing any window happens to be on the top
5
4140
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 NullReferenceException and InvalidOperationException : The object is currently in use elsewhere. Unfortunately this appears to be a race condition. These exceptions appear to ocurr while disposing GDI+ objects, the Graphics object seems to be the...
0
1838
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 with the file system (including printing) from the web browser. How do I disabled this so I can get my windows form control to work within IE? Also, do any have any printing code or know how I can implement multipage printing using the...
0
1411
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 (creates a PrintDocument and prints the object) The data prints as intended, however, when printing is completed, the startup form then receives focus (the form I printed from gets hidden behing the startup form) I have worked around this by adding...
2
1233
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
7016
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 application? Max
0
2851
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 printing printing data and the actual database data in a recordset. the class looks like this: Public Class BRPDD 'Balance Report PrintingDocument Data Public totalReceiptsNum As Integer Public totalLicFee As Double
0
10306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9931
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5504
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.