make pdf file from a report

mana

Registered User.
Local time
Today, 13:37
Joined
Nov 4, 2014
Messages
265
Hi,

i have the following code to make the pdf form a report. but i want to make the pdf in landscape mode and also each time with a new name.
can you help me please?
how can i change it?

If Me.Combo3.Value = "" Or IsNull(Me.Combo3.Value) Then
MsgBox "Please enter order number!", vbExclamation, "Order number required"
' ElseIf Me.cmb_AuftragNummer.Value Like "*[a-z]*" Or Len(Me.cmb_AuftragNummer.Value) <> 6 Then
'MsgBox "Invalid order number!", vbExclamation, "Invalid order number"
Else
DoCmd.OpenReport "rep_CQAReport", acViewPreview, , "[Fehlercode] = '" & [Combo3] & "'"
DoCmd.Close acForm, "frm_rep_cqaReport_filter"
DoCmd.OutputTo acOutputReport, "rep_CQAReport", acFormatPDF, "O:\Applications\CQA Reporting\PDFTest01.pdf", False
End If

thank you
 
If you make the report landscape the PDF should follow. You can concatenate within the path argument to make the name dynamic.
 
Hello

Thank you for your reply
What do you mean with concatenate the path?
I searched but I couldn't find a proper one.
 
Like:

"O:\Applications\CQA Reporting\PDFTest" & Whatever & ".pdf"

Whatever could be a variable, form reference, etc.
 
hi,

thank you for the reply
i tried it out
but it doesn't work and each time the new one will be overwritten in the last file.
can you help me please?
 
ps: and also with the same name
i mean the name is the same
 
The "& Whatever &" bit should be something that changes based on the report - so set it either to a date or a unique order number etc.
 
Hi

sorry but i am new to ms access
i can't understand exactly
how should i set it to date? or a unique number?
 
Hi

i wrote the below code but i don't know where is my error?
can you help me please?

If Me.Combo3.Value = "" Or IsNull(Me.Combo3.Value) Then
MsgBox "Please enter order number!", vbExclamation, "Order number required"
' ElseIf Me.cmb_AuftragNummer.Value Like "*[a-z]*" Or Len(Me.cmb_AuftragNummer.Value) <> 6 Then
'MsgBox "Invalid order number!", vbExclamation, "Invalid order number"
Else
DoCmd.OpenReport "rep_CQAReport", acViewPreview, , "[Fehlercode] = '" & [Combo3] & "'"
DoCmd.Close acForm, "frm_rep_cqaReport_filter"
DoCmd.OutputTo acOutputReport, "rep_CQAReport", acFormatPDF, "O:\Applications\CQA Reporting\PDFTest" & rep_CQAReport.[Auftragsnummer] & ".pdf", False
End If
 
hello

thank you
i could find it
but when i chnage the report to landscape
i have the following error:
runtime error 2501
the open report action was canceled
can you help me please?
what is my error?
i didn't change the code?
 
I think this:

rep_CQAReport.[Auftragsnummer]

would need to be

Reports!rep_CQAReport.[Auftragsnummer]

Does the report open from the navigation pane without error?
 
Hi

thank you
no it is not opened also from navigation pane
i atached the pictures
thank you
 

Attachments

  • Unbenannt.jpg
    Unbenannt.jpg
    100.1 KB · Views: 93
  • Unbenannt1.jpg
    Unbenannt1.jpg
    93.1 KB · Views: 84
Have you made it landscape in page setup? Can you post the db here?
 

Users who are viewing this thread

Back
Top Bottom