A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I create a button to print a report for a specific record?



 
 
Thread Tools Display Modes
  #1  
Old May 26th, 2005, 04:08 PM
BANKHR
external usenet poster
 
Posts: n/a
Default How do I create a button to print a report for a specific record?

I've created a form that users can fill out. I want to include a command
button on the form that prints a report that I've created as well. The
problem I'm having is that I can't figure out how to print a report for a
single record. Right now, I can only get it to reports for every single
record in my database.

I've tried to creat a macro to do this, but no luck so far.

Any help would be appreciated.
  #2  
Old May 26th, 2005, 04:16 PM
fredg
external usenet poster
 
Posts: n/a
Default

On Thu, 26 May 2005 08:08:01 -0700, BANKHR wrote:

I've created a form that users can fill out. I want to include a command
button on the form that prints a report that I've created as well. The
problem I'm having is that I can't figure out how to print a report for a
single record. Right now, I can only get it to reports for every single
record in my database.

I've tried to creat a macro to do this, but no luck so far.

Any help would be appreciated.


Your table should have a unique prime key field.

If so, code the command button's Click event:
DoCmd.OpenReport "ReportName", acViewPreview, , "[RecordID] = " &
[RecordID]

The above assumes a [RecordID] field that is a Number Datatype.

If [RecordID] is Text Datatype, then use:

"[RecordID] = '" & [RecordID] & "'"

as the Where clause.
Change the field name to whatever the actual field name is that you
are using.

See Access Help files for:
Where Clause + Restrict data to a subset of records'
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
  #3  
Old May 26th, 2005, 04:17 PM
Dennis
external usenet poster
 
Posts: n/a
Default

I assume something on the form makes this particular record unique.
If so the in the click of the button add the code

DoCmd.OpenReport "Your Report Name", acViewNormal, , "[UniqueID] = " &
Me.UniqueID

"BANKHR" wrote:

I've created a form that users can fill out. I want to include a command
button on the form that prints a report that I've created as well. The
problem I'm having is that I can't figure out how to print a report for a
single record. Right now, I can only get it to reports for every single
record in my database.

I've tried to creat a macro to do this, but no luck so far.

Any help would be appreciated.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to show both "Yes" and "No" answers from a "yes/no" checkbox? Colin Foster New Users 28 March 18th, 2005 02:19 PM
from a FORM print a label report 3 labels per sheet for CURRENT re babs Setting Up & Running Reports 7 February 6th, 2005 06:38 PM
Help!! I'm running around in circles! CathyA New Users 19 December 12th, 2004 07:50 PM
Label SRIT General Discussion 2 June 22nd, 2004 09:42 PM
How to create a print button. [email protected] Setting up and Configuration 2 November 5th, 2003 12:17 PM


All times are GMT +1. The time now is 11:31 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.