KeythStone
New Member
- Joined
- Mar 30, 2011
- Messages
- 36
Hello,
Trying to use a record from "ReportList" as part of the filename where I'd publish a report named the same as the record. So say the record was "ReportName"
I'd want something like:
Function test()
On Error GoTo test_Err
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim StrClient As String
Set db = CurrentDb()
Set rst = db.OpenRecordset("ReportList", dbOpenDynaset)
rst.MoveFirst
Do While Not rst.EOF
With rst
StrClient = "F:\OP_CS\Client Reporting\(ReportName)\AIM\" & Format(Date, "yyyymmdd") & ".pdf"
DoCmd.OpenReport "AIM (Assignment,DB): ALL OPEN (AIM by DB: ALL OPEN)", acViewPreview, "", "", acNormal
DoCmd.OutputTo acOutputReport, "AIM (Assignment,DB): ALL OPEN (AIM by DB: ALL OPEN)", "PDFFormat(*.pdf)", StrClient, False, "", 0, acExportQualityPrint
DoCmd.Close acReport, "AIM (Assignment,DB): ALL OPEN (AIM by DB: ALL OPEN)"
.MoveNext
End With
Loop
rst.Close
test_Exit:
Exit Function
Any thoughts if this will work. I'm still trying different things. All help is appreciated,
Stay Smooth,
KeythStone
Trying to use a record from "ReportList" as part of the filename where I'd publish a report named the same as the record. So say the record was "ReportName"
I'd want something like:
Function test()
On Error GoTo test_Err
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim StrClient As String
Set db = CurrentDb()
Set rst = db.OpenRecordset("ReportList", dbOpenDynaset)
rst.MoveFirst
Do While Not rst.EOF
With rst
StrClient = "F:\OP_CS\Client Reporting\(ReportName)\AIM\" & Format(Date, "yyyymmdd") & ".pdf"
DoCmd.OpenReport "AIM (Assignment,DB): ALL OPEN (AIM by DB: ALL OPEN)", acViewPreview, "", "", acNormal
DoCmd.OutputTo acOutputReport, "AIM (Assignment,DB): ALL OPEN (AIM by DB: ALL OPEN)", "PDFFormat(*.pdf)", StrClient, False, "", 0, acExportQualityPrint
DoCmd.Close acReport, "AIM (Assignment,DB): ALL OPEN (AIM by DB: ALL OPEN)"
.MoveNext
End With
Loop
rst.Close
test_Exit:
Exit Function
Any thoughts if this will work. I'm still trying different things. All help is appreciated,
Stay Smooth,
KeythStone