473,651 Members | 2,987 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Print the current record of a form

I have a form that consists of 150 records and is still growing.
there are times when I want to print a certain record of the form, say
record 12. I go to file --> print and choose the page number of the
record. But what I would like to do, to decrease the amount of
mistakes of print all 150+ records, I would like a button to only
print the record that is currently displayed on screen. I know it can
be done, I just don't know how. Any suggestions? Thanks!
Nov 13 '05 #1
2 3580
On 17 Jun 2004 13:17:38 -0700, pm*****@thelynd co.com (Paul Mendez) wrote:
I have a form that consists of 150 records and is still growing.
there are times when I want to print a certain record of the form, say
record 12. I go to file --> print and choose the page number of the
record. But what I would like to do, to decrease the amount of
mistakes of print all 150+ records, I would like a button to only
print the record that is currently displayed on screen. I know it can
be done, I just don't know how. Any suggestions? Thanks!


First of all you shouldn't really be printing the form. Forms are for viewing, reports are for printing.
Create a report containing the same info as shown on the form. As a starting point you can right click on the form name
in the database window and select "Save as report". This will generate a report which will look the same as your form,
which you can then edit to suit your needs. (eg remove unwanted controls such as command buttons etc)

Make sure that both your form and report's recordsource contains the Primary Key field of the records.
Add a command button to your form (cmdPrint) and put the following code in the OnClick event of the button -

DoCmd.OpenRepor t "rptMyReport",, ,"[PrimaryKeyField]=" & Me.PrimaryKeyFi eld

Change rptMyReport to the name of your report.
Change PrimaryKeyField to the name of your primary key field.

This will print a single record report showing details of the current record in the form.
Wayne Gillespie
Gosford NSW Australia
Nov 13 '05 #2
Hi Paul,
In Access97 at least ... this is how it's done.

Private Sub cmdPrintCurrent Record_Click()
On Error GoTo Err_cmdPrintCur rentRecord_Clic k

'The Wizard does it this way:
'DoCmd.DoMenuIt em acFormBar, acEditMenu, 8, , acMenuVer70

'But I prefer:
DoCmd.RunComman d acCmdSelectReco rd
DoCmd.PrintOut acSelection

Exit_cmdPrintCu rrentRecord_Cli ck:
Exit Sub

Err_cmdPrintCur rentRecord_Clic k:
MsgBox Err.Description
Resume Exit_cmdPrintCu rrentRecord_Cli ck
End Sub

HTH,
Don
Paul Mendez <pm*****@thelyn dco.com> wrote in message
news:99******** *************** *@posting.googl e.com...
I have a form that consists of 150 records and is still growing.
there are times when I want to print a certain record of the form, say
record 12. I go to file --> print and choose the page number of the
record. But what I would like to do, to decrease the amount of
mistakes of print all 150+ records, I would like a button to only
print the record that is currently displayed on screen. I know it can
be done, I just don't know how. Any suggestions? Thanks!

Nov 13 '05 #3

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

Similar topics

1
5850
by: Aftershock | last post by:
I have looked on the groups but can't seem to find an answer. I have a parameter query that uses a form for its input. This form then opens up a search result form based on the query. It is from this form that I want to print via a report all of the returned records shown on the form. I can print off a single current record shown in the form (say record 3 of 5) using this code: Private Sub cmdPrintCurrent_Click()
0
2191
by: Nick H | last post by:
Hi, I have a form containing a subform. I have placed some vb within the subform to print the current record. When I use this vb from within the main form, it prints all of the records for the individual (i.e, the main form). I only want it to print the current record though. This is because the vb is not specifically selecting the subform as the 'focus' or 'current' form. eg:
3
11862
by: sea | last post by:
I need to be able to print the current form because the form has an embedded object of a .gif file, so report will not work -- does anyone know the way to do this? I tried some code, not sure what it was now, guess docmd.printout or something but that prints ALL the forms -- also the each page of the form does not always start at the next page even if allowcontinuousforms is set to no. The preview button previews all the forms as well,...
1
3136
by: Randy | last post by:
I have tried the code to attach a button to a form and use the help information on coding, but I can't seem to get it to work. I have a main form called MAIN CLIENT INFO2 There is a subform called Client Contacts. I want to print the current record using the ID field in the Client Contacts subform in a report. I want to print to a report called MAIN CLIENT INFO using the current record in the subform.
3
1825
by: simonmarkjones | last post by:
Hi i need to be able to print a report to act as a receipt for customers. If i put a button on a form to do this it wont print the current details on a newly created form (Prints Report with no completed details from textboxes) It works if i click to go to next record and then come back (Saving record). Would idealy like to be able to print whats currently been filled in the current record. Do i need to get it to save the form before i...
6
8094
by: shulls | last post by:
I am trying to print the curent record that I have selected on the curent page in a form that I have created, with a subform on that same page. If I just do a "print" it will print only the first record. If I tell it to print selected record it will print the selected record in the form but not the subform. Any help with this would be greatly appreciated.
1
1907
by: hosi | last post by:
Hi, suppose I want to print third record from a subform. The problem is, that when I want to print what I see on my monitor (third record), the print preview resets the form to the first record (wants to print the whole form beginning). Is the any possibility to print a particular record, without making screenshots? Please, help me!!!
2
2914
by: Ste | last post by:
Hi, I would like to print the current showing record from the Form screen but don't know where to start. Here are what I have: I can print any records from report built from query that has filter setup. But if I am in data entry Form, and want to get the record displayed to print out in the same format of report, I can't.
12
3529
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to print the report three times, but do not know how
0
8361
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8701
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8466
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
8584
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
7299
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...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
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
1
1912
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.