Group:  Microsoft Access ยป microsoft.public.access.reports
Thread: Print an individual record via a Report

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Print an individual record via a Report
"jamiecockrill" <jamie.cockrill[ at ]gmail.com> 25.09.2006 14:27:42
Hi there, I'm quite new to Access, so please be gentle!

I've created a Report to set the format in which I want my records
printed, however at the moment, when I click the Print Record button
that I created with a Wizard, if prints every single record in the
table I referred it to.

What I have is a 'View Work Requests' form called "View Request2" which
prompts me for a Work request number (field in the table is called
'Project Reg Number'). It then searches the database and returns the
data to the form. I essentially want a button that prints that record.

I've tried sticking an SQL WHERE query in, but it evidently doesn't do
very much!

Thanks for you help

Jamie

PS, the code for that section is:

Private Sub print_report_Click()
On Error GoTo Err_print_report_Click

DoCmd.OpenReport "Print Report", acNormal, "[Project Reg
Number]=View Request2![Project Reg Number]"

Exit_print_report_Click:
Exit Sub

Err_print_report_Click:
MsgBox Err.Description
Resume Exit_print_report_Click

End Sub

Re: Print an individual record via a Report
"jamiecockrill" <jamie.cockrill[ at ]gmail.com> 25.09.2006 15:24:33
After a bit of fiddling with the VB Code, I now have this as my query:

DoCmd.OpenReport "Print Report", acNormal, , "[Project Reg Number]
= " & Me![Project Reg Number]

this seems to bring up a dialog box, with the Project Reg Number as the
variable name (or something) and then a text-box to enter the Project
Reg Number (which is essentially copying what's above it)

So it looks like:

Enter Parameter value (the dialog box heading)
W0982 (an example of the record
numbers I use)
[Box to put number in] (i.e. just putting W0982, in this case,
back in)

thanks

Jamie

Re: Print an individual record via a Report
"jamiecockrill" <jamie.cockrill[ at ]gmail.com> 26.09.2006 11:21:08
I received a fix on another forum, so I thought I'd post it here. I
replaced the following:

"[Project Reg Number] = " & Me![Project Reg Number]

with:

"[Project Reg Number]= Forms![View Request2]![Project Reg Number]"

and it worked fine (where View Request2 is the form name and Project
Reg Number is the text-box containing the data I wanted.

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net