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 / December 2005

Tip: Looking for answers? Try searching our database.

Print current record from form to report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rml - 28 Nov 2005 19:50 GMT
I have a form with the following code in a command button.  I would like to
print that current record onto a report.  It prints out the record on the
report but it also prints the all the records form the form.  Does anyone
know what I'm doing wrong here?

Thanks.

Private Sub Command217_Click()
On Error GoTo Err_Command217_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
   Dim stDocName As String
   Dim stLinkCriteria As String

   stDocName = "aaa"
   
   stLinkCriteria = "[ID]=" & Me![ID]
   DoCmd.OpenReport stDocName, , , stLinkCriteria
DoCmd.DoMenuItem acFormBar, acFile, 6

Exit_Command217_Click:
   Exit Sub

Err_Command217_Click:
   MsgBox Err.Description
   Resume Exit_Command217_Click
   
End Sub
Patrick Stubbin - 29 Nov 2005 02:27 GMT
I suspect that the underlying query for the report is too broad....

Signature

Regards

Patrick Stubbin

> I have a form with the following code in a command button.  I would like to
> print that current record onto a report.  It prints out the record on the
[quoted text clipped - 23 lines]
>    
> End Sub
Compuhelpmt - 11 Dec 2005 23:47 GMT
Yes, your query needs to be changed. In the criteria area of the primary key
field in the query design, enter the Forms!Nameofform fieldname
When you run the report, it will get the info from the query, which looks at
your form for the record you are highlighted on.

>I have a form with the following code in a command button.  I would like to
> print that current record onto a report.  It prints out the record on the
[quoted text clipped - 23 lines]
>
> End Sub
 
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.