Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / October 2007

Tip: Looking for answers? Try searching our database.

Print shown records of a form in report???? HELP STUCK

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Juped - 21 Oct 2007 11:39 GMT
Ok so ive got a form showing the order details of a customer in a subform, i
want to print these details shown on that one form in an already built
report. If i make a command button just print the report it looks messy and
un reciept like, but if i print the report it prints all the data in the
table. When you reply can you do it step by step slowly... Thanks.
fredg - 21 Oct 2007 17:01 GMT
> Ok so ive got a form showing the order details of a customer in a subform, i
> want to print these details shown on that one form in an already built
> report. If i make a command button just print the report it looks messy and
> un reciept like, but if i print the report it prints all the data in the
> table. When you reply can you do it step by step slowly... Thanks.

First create a report tha displays all the data you want, the way you
want it displayed.

Your table should have a unique prime key field.
In my example it is named [RecordID].

On the command button's property sheet write
[Event Procedure]
on the Click event line.
Then click on the little button with 3 dots that will appear on that
line.
When the code window opens, the cursor will be flashing between 2
already existing lines of code.
Between those 2 lines write:

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "ReportName", acViewPreview, , "[RecordID] = " &
[RecordID]

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

If, however, [RecordID] is Text Datatype, then use:

DoCmd.OpenReport "ReportName", acViewPreview, ,"[RecordID] = '" &
[RecordID] & "'"

as the Where clause.

For clarity, the single and double quotes are..
"[RecordID] = ' " & [RecordID] & " ' "
Change [RecordID] to whatever the actual field name is that you are
using.

See VBA Help files for:
Where Clause + Restrict data to a subset of records
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.