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 / Reports / Printing / March 2007

Tip: Looking for answers? Try searching our database.

Printing the current record

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan Goble - 06 Mar 2007 18:01 GMT
You guys rule...!
I am getting it done here better than anywhere I have tried.

Next problem:

I have a form open with all the information filled in to a record to be
printed to a report that is actually a contract.  I want to populate the
fields in the report with only the info from the current record Name etc.  I
have inserted the controls in the contract (report) and they show fine.  The
problem is that there are previous records and the thing wants to print only
the last record.  How do I print from that form with just the record that I
am looking at?  Or I guess I should say the current record.
Thanks
Dan
fredg - 06 Mar 2007 18:53 GMT
> You guys rule...!
> I am getting it done here better than anywhere I have tried.
[quoted text clipped - 10 lines]
> Thanks
> Dan

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

Add a command button to your form.
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.