By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,471 Members | 2,264 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,471 IT Pros & Developers. It's quick & easy.

Print the current record of a form

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.