473,388 Members | 1,385 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,388 software developers and data experts.

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 3528
On 17 Jun 2004 13:17:38 -0700, pm*****@thelyndco.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.OpenReport "rptMyReport",,,"[PrimaryKeyField]=" & Me.PrimaryKeyField

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 cmdPrintCurrentRecord_Click()
On Error GoTo Err_cmdPrintCurrentRecord_Click

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

'But I prefer:
DoCmd.RunCommand acCmdSelectRecord
DoCmd.PrintOut acSelection

Exit_cmdPrintCurrentRecord_Click:
Exit Sub

Err_cmdPrintCurrentRecord_Click:
MsgBox Err.Description
Resume Exit_cmdPrintCurrentRecord_Click
End Sub

HTH,
Don
Paul Mendez <pm*****@thelyndco.com> wrote in message
news:99************************@posting.google.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
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...
0
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...
3
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...
1
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...
3
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...
6
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...
1
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...
2
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...
12
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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...

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.