Page 1 of 7 1234567 LastLast
Results 1 to 15 of 100

Export PDF

  1. #1
    ingarchsf is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    50

    Export PDF

    Hi,
    I'm new here, and I've found this thread https://www.accessforums.net/program...ing-33816.html because I need exactly something like that..

    But.. I don't know how to use that code.. I use Access, creating from procedures, but I don't know anything of Visual Basic.. is there anyone who can help me in using that code, please?
    My aim is to have something like that, but the name has to be composed by "Surname" field and "Date of the course" field.

    The structure of the DB is similar, I have a Report based on a query which takes from many tables, linking fields. The query has an input request when opens. I made this, but I'd like to export each page of the Report (which represent the certificates for the courses attended by each person in each course -each page is a certificate identified by name-surname-date of the course-etc..) as a separate PDF, with the surname of the attendant and the date of the course attended.

    Is it possibile?
    Last edited by June7; 08-19-2014 at 09:47 AM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,339
    Note that I split your post to a new thread. Hijacking thread is not appropriate. For one thing, your question does not get as much attention, especially tagged on to a thread already marked Solved.

    The example code in the referenced thread is behind a command button on a form. If you want to learn VBA, here is a starting point http://office.microsoft.com/en-us/ac...010341717.aspx
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ingarchsf is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    50
    Hi, sorry, I didn't know about the "solved" thread.

    By the way.. I don't need now to learn VBA, I only need a help in modifying that code, in order to use it

    Is there anyone who can help me?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,339
    Lots of helpers here.

    If you are going to use VBA then you need to learn it, even just to implement this one procedure you need some basic understanding of programming concepts and VBA language and how to interact with the VBA editor.

    No idea what modifications need to be done for your situation. Replace field names as appropriate. Attempt code and test and when you encounter specific issue, post question and your code for analysis.

    Review link at bottom of my post for debugging guidelines.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ingarchsf is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    50
    Ok,
    thank you for the advice, really, but it's not what I need now. I know something to USE VBA just in order to use ArcGIS Software, and then something related to Access.

    Now.. I've built a system to print some certificates automatically, but I need a help JUST to add to it something that could separate each certificate (page of the report) into a single PDF file, named with the Surname and the Date of the event automatically.

    The basis of that Code seems useful for me, but I need to know which parts are to be edited to fit my situation (so which are the editable source strings) and how to edit the procedure of naming each file with 2 field of the database, and not only one.

    Code:
    Private Sub Command0_Click()
    Code:
    Dim MyDB As DAO.Database
    Dim MyRS As DAO.Recordset
    Dim strSQL As String
    Dim strRptName As String
    Dim count As Integer
     
    strRptName = "FieldReconnFormReport"
    strSQL = "Select tblFieldReconn.[FacilityID] FromRptQry_List_Table_For_Entech_Use;"
    
    Set MyDB = CurrentDb
    Set MyRS = MyDB.OpenRecordset(strSQL, dbOpenForwardOnly)
    
    With MyRS
    
    Do While Not MyRS.EOF
    DoCmd.OpenReport strRptName, acViewPreview, ,"[FacilityID]=" & ![FacilityID]
    DoCmd.OutputTo acOutputReport, strRptName, acFormatPDF,"C:\Temporary FR Forms\" & ![FacilityID] &"_FRECON.pdf"
    DoCmd.Close acReport, strRptName, acSaveNo
    .MoveNext
    Loop
    End With
    MyRS.Close
    Set MyRS = Nothing
    End Sub

  6. #6
    ingarchsf is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    50
    Ok, I've tried like this:

    Code:
    Private Sub Command0_Click()
    Dim MyDB As DAO.Database
    Dim MyRS As DAO.Recordset
    Dim strSQL As String
    Dim strRptName As String
    Dim count As Integer
    
    strRptName = "Attestati_2014"
    strSQL = "Select Selezione_corso_2014.[Cognome] From Selezione_corso_2014;"
    Set MyDB = CurrentDb
    Set MyRS = MyDB.OpenRecordset(strSQL, dbOpenForwardOnly)
    With MyRS
    Do While Not MyRS.EOF
    DoCmd.OpenReport strRptName, acViewPreview, , "[Cognome]='" & ![Cognome] & "'"
    DoCmd.OutputTo acOutputReport, strRptName, acFormatPDF, "C:\Attestati\" & ![Cognome] & Format(!Data_modulo, "YYYYMMDD") & ".pdf", False
    DoCmd.Close acReport, strRptName, acSaveNo
    .MoveNext
    Loop
    
    End With
    MyRS.Close
    Set MyRS = Nothing
    End Sub
    but the line Set MyRS = MyDB.OpenRecordset(strSQL, dbOpenForwardOnly) has run-time error 3061: not enough parameters. 3 prameters expected.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,339
    Good effort.

    Is Selezione_corso_2014 a table or is it a query with dynamic input parameter popups? If the latter, the popups are causing the 'not enough parameters' error because the popups can't happen and the query does not receive the inputs. The query should reference controls on an open form for inputs.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    ingarchsf is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    50
    Yes, the latter!
    Uhm.. so, how can I solve it? :-/
    I need to select information in input, because, otherwise, a lot of files will be exported..

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,339
    As stated, use a form. Input into unbound controls (textbox, combobox, listbox). Query references form controls for parameters instead of the popups.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    ingarchsf is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    50
    Do you mean something like a search screen? How to build it?

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,339
    Build a form - basic Access functionality. Put UNBOUND controls on form. Enter values into controls. Query references controls as parameters. Review: http://www.datapigtechnologies.com/f...earchform.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    ingarchsf is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    50
    ahhhhh, a mask! We use to call the form "mask".
    So, is it possibile to link each unbound control with boolean espressions, like "and" or "or"? Or.. is it automatic?
    With "Query references controls as parameters" do you mean "insert them into the code"?

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,339
    If by code you mean the query SQL statement - yes. Reference to form parameters goes in the query. Did you review the video? Post the query SQL statement for analysis. Switch query builder to SQL View.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    ingarchsf is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    50
    Here is the SQL query

    Code:
    SELECT [2014].N_corso, Corsi.Titolo_corso, [2014].N_modulo, Moduli.Titolo_modulo, Moduli.Data_modulo, Moduli.[Codice evento], Moduli.CFP, Anagrafica.Cognome, Anagrafica.Nome, [2014].CF, Anagrafica.Ordine, Anagrafica.Iscrizione, Anagrafica.SezioneAlbo, Anagrafica.Titolo, [2014].Note
    FROM Anagrafica INNER JOIN (Corsi INNER JOIN (Moduli INNER JOIN 2014 ON Moduli.N_modulo = [2014].N_modulo) ON (Corsi.N_corso = Moduli.N_corso) AND (Corsi.N_corso = [2014].N_corso)) ON Anagrafica.CF = [2014].CF
    WHERE ((([2014].N_corso) Like [Maschere]![Ricerca_Attestati].[qncorso1] & "*") AND (([2014].N_modulo) Like [Maschere]![Ricerca_Attestati].[qnmodulo1] & "*") AND ((Anagrafica.Cognome) Like [Maschere]![Ricerca_Attestati].[qcognome1] & "*"))
    ORDER BY [2014].N_corso, Anagrafica.Cognome;
    when I click on "search", an error occurs: run-time error 3270, property not found..

    If I click on Debug.. it highlights the line DoCmd.OpenQuery "Selezione_corso_2014", acViewNormal
    and "Selezione_corso_2014" is the query above.

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,339
    Can't see anything wrong with query or code.

    But why is code opening query instead of form or report?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 1 of 7 1234567 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 06-04-2014, 01:25 PM
  2. Export as PDF
    By lugnutmonkey in forum Import/Export Data
    Replies: 1
    Last Post: 02-19-2013, 11:23 AM
  3. Export to Word
    By Monterey_Manzer in forum Import/Export Data
    Replies: 0
    Last Post: 12-20-2012, 02:06 PM
  4. CSV Export
    By mchadwick in forum Access
    Replies: 1
    Last Post: 09-06-2011, 03:19 PM
  5. Export
    By vvasudev in forum Import/Export Data
    Replies: 2
    Last Post: 01-20-2010, 11:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums