8
I created a table called Funcionarios
where I have at least 2 fields:
ID
and caminho_impressao
.
Where I put it for example:
- C: User Users1 Documents\
- C: User Users2 Documents\
Then I tried to print a PDF of a report as follows:
Dim FileNamePDF As String
Dim SetDirectoryPDF As String
Dim strRelatorio As String
' set directory to save to
SetDirectoryPDF = DLookup("caminho_impressao", "Funcionarios", "ID=" & login.ID)
'set the filename and save location
strRelatorio = "Relatorio_mensal"
'Tentei e não deu
'FileNamePDF = SetDirectoryPDF & strRelatorio & ".pdf"
FileNamePDF = CStr(SetDirectoryPDF) & strRelatorio & ".pdf"
MsgBox FileNamePDF
DoCmd.OutputTo acOutputReport, strRelatorio, acFormatPDF, FileNamePDF, False
But I could not generate the file. The following error message appears:
Question
How can I deal with this particular mistake?
A question: what is displayed in the call 'Msgbox Filenamepdf'? I ask this as the error may be due to something wrong in the output file path/name.
– Luiz Vieira
Incidentally, silly question (I know), but the path exists?
– Luiz Vieira
I actually already solved the problem, it was all right, I just needed to compress and fix the bd, so everything worked perfect.
– Regis Santos
Good then! How about you add an answer with your conclusions? This can help someone else in the future. :)
– Luiz Vieira
You could put the solution here for us to learn too?
– Maniero