I created a table called Funcionarios
where I have at least 2 fields:
ID
and caminho_impressao
.
Where I put it, for example:
So 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 error?