Kamis, 24 April 2014

RE: [MS_AccessPros] Export Report to pdf

 

Brilliant.

 

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Duane Hookom
Sent: Wednesday, April 23, 2014 6:58 PM
To: Access Professionals Yahoo Group
Subject: RE: [MS_AccessPros] Export Report to pdf

 




I would start by creating some code that loops through an DAO recordset and simply debug.print the Person Nm field. Once you have this loop working then you add some additional code that does a little more.
 
Dim rs as DAO.RecordSet
Dim db as DAO.Database
Dim strSQL as String
Set db = Currentdb
strSQL = "SELECT DISTINCT PersonNm FROM tblTUFMemoForOwnerReimbursedCellPhone"
Set rs = db.CreateRecordset(strSQL)
With rs.
    .MoveFirst
    Do Until .Eof
        Debug.Print .Fields("PersonNm")
        .MoveNext
    Loop
    .Close
End With
Set rs = Nothing
Set db = Nothing
 
I would take the record source query behind the report and change its SQL property to match the PersonNm field.
---
Do Until .Eof
    Debug.Print .Fields("PersonNm")
   db.QueryDefs("YourReportRecordSource").SQL = "SELECT * FROM SomeTable WHERE PersonNum = " & .Fields("PersonNm")
    .MoveNext
Loop
---
Finally add a line of code that sends your report to pdf after the line that sets the SQL of the querydef.
 
Duane Hookom MVP
MS Access

 


To: MS_Access_Professionals@yahoogroups.com
From: luvmymelody@yahoo.com
Date: Wed, 23 Apr 2014 14:56:42 -0700
Subject: [MS_AccessPros] Export Report to pdf



Hello all,


I have a report that I would like to export to a folder. The source of the report is a table and I would like the do loop to export a separate report for each person in the Person Nm field. I have spent 2 days researching code that could do this and nothing is working. 


Is there some generic code that could perform this action? 
The table name is tblTUFMemoForOwnerReimbursedCellPhone
The fields are Person Nm, Goal Bal, Dept Ld
The Report name is memo report


Thank You


Jim Wagner






This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)
.

__,_._,___

Tidak ada komentar:

Posting Komentar