Vaibhavjoshi2005
asked on
Dynamic filename in access exportwithformatting
I have a form which shows details of one business organisation at a time. The primary field is business registration number.
I also have few reports on same form which are always run for the business entity of that form. (meaning the query refers to [forms]![Org]![reg_no]
I have written a macro and converted to VBA. I want now access to save file with above reg_no. Eg for reg no U123AS it should save as
Share certificates U123AS.pdf
Below is the VBA code ;
==================
Function Macro1()
On Error GoTo Macro1_Err
DoCmd.OutputTo acOutputReport, "Share Certificates", "PDFFormat(*.pdf)", "Share Certificates" & Format(Now(), "ddmmyyhhnn") & ".pdf", False, "", , acExportQualityPrint
Macro1_Exit:
Exit Function
Macro1_Err:
MsgBox Error$
Resume Macro1_Exit
End Function
I also have few reports on same form which are always run for the business entity of that form. (meaning the query refers to [forms]![Org]![reg_no]
I have written a macro and converted to VBA. I want now access to save file with above reg_no. Eg for reg no U123AS it should save as
Share certificates U123AS.pdf
Below is the VBA code ;
==================
Function Macro1()
On Error GoTo Macro1_Err
DoCmd.OutputTo acOutputReport, "Share Certificates", "PDFFormat(*.pdf)", "Share Certificates" & Format(Now(), "ddmmyyhhnn") & ".pdf", False, "", , acExportQualityPrint
Macro1_Exit:
Exit Function
Macro1_Err:
MsgBox Error$
Resume Macro1_Exit
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.