Jump to content
  • 0

Impressão de formulários de Acess directamente em pdf


Ora viva!

Preciso da vossa ajuda...


Tenho uma base de dados em Acess e necessitava que em vez de ter que abrir o formulário e depois escolher a impressora, gostaria de fazer logo a impressão em pdf.

Escrevi a seguinte expressão, mas continua a dar o erro 2059: BD não consegue localizar objecto '|1'


Private Sub ImpFT_PDF_Click()

On Error GoTo Err_ImpFT_PDF_Click

    Dim stDocName As String
    Dim strArquivo As String
    Dim strLocal As String
    strArquivo = Me.Designacao & Me!Designacao & ".pdf"
    strLocal = CurrentProject.Path & "\FT\" & strArquivo
    'stDocName = "FichaTecnica01"
    stDocName = Forms!rotulos.Controls!ModeloFT
    'Abre formulário
    DoCmd.OpenReport stDocName, acViewNormal, "FiltroFT", , , acViewNormal
    'Gera o pdf
    DoCmd.OutputTo acOutputReport, "FiltroFT", acFormatPDF, strLocal
    'Fecha o formulário
    DoCmd.Close acForm, "FiltroFT"
    DoCmd.OpenReport "FiltroFT", acViewPreview
    Exit Sub

    If Err.Number = 94 Then
       MsgBox "Não existe nome de relatório definido"
       MsgBox Str(Err.Number) + ": " + Err.Description
    End If
    Resume Exit_ImpFT_PDF_Click
End Sub


Alguém consegue me ajudar?

Edited by nephrops
Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Encontrei isto:


That particular error almost always means that some error has occurred in the form or report you were trying to output based on having named something in the form's RECORDSOURCE query or on a control's ROWSOURCE query, when you spelled the object wrong or named an object that didn't appear in the referenced query's underlying recordset.

I.e. the query processor failed to find an element in something that implies use of a query.

Daqui. Vê se te ajuda.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.