Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2002
    Join Date
    Jan 2017
    Posts
    57

    Report is Lost

    I have a Microsoft Access App that generates a report. I can view that report for one day. When I open the file on the next day, the report is gone. How can I get the original report, or save it so it can be viewed later?

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    It sounds like the Report might be tied to a date, and specificallt the current day. Assuming that the report is based on a query, you could change the query so that instead of defaulting to the current day, you could have a Parameter Query that prompts the user for what date they would like to run it for. See here for help on creating Parameter Queries: http://www.gcflearnfree.org/access20...meter-query/1/

    You could also print the report to a PDF each day, and store it in a folder.

    If that is not what is going on, please provide a lot more details, like maybe the SQL code of your query, so we aren't guessing as to how this all works.

  3. #3
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2002
    Join Date
    Jan 2017
    Posts
    57
    I would like to have the program generate a PDF and store it in a file, every time a report is produced.

  4. #4
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    How is the report being produced? Is someone running it manually every day?
    If so, then you are dependent upon someone doing that every day.
    Otherwise, you can try to automate something, like have a Scheduler program open the database and run the report to a file every day.

  5. #5
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2002
    Join Date
    Jan 2017
    Posts
    57
    The program consists of a Registration of participants. Then a Poll of those participants. There is a Query to obtain the Total of Votes, and a Query for the report. There is a Vote Date in each of those Queries.
    The program is run manually at infrequent intervals, when an event requires it. Now I can view the Report on the day of the event, but not on subsequent days, because there is no report for that day.
    I don't want to have to input a date, but a list of dates would be OK. A PDF in a Folder that I can reach with File Explorer, with Time & Date noted would be my preference. I could select the item of interest based on Time & Date.

  6. #6
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2002
    Join Date
    Jan 2017
    Posts
    57
    This is the code I have for generating the PDF Report.
    [code}
    Private Sub btnResults_Click()
    Dim strPathAndFile As String
    DoCmd.OpenReport "rptVoteSummary", acViewPreview
    DoCmd.OutputTo acOutputReport, "rptVoteSummary", "PDFFormat(*.pdf)", strPathAndFile = "C:\Users\Home7\Documents\Vote Reports\Vote Report.pdf", True, acExportQualityScreen
    End Sub
    [/code]

    I get an error for 'acExportQualityScreen'

    'DoCmd.OpenReport "rptVoteSummary", acViewPreview' outputs the report to the screen. I need to output a copy to a PDF file.

  7. #7
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Try: DoCmd.OutputTo acOutputReport, "rptVoteSummary", acFormatPDF, strPathAndFile = "C:\Users\Home7\Documents\Vote Reports\Vote Report.pdf"

  8. #8
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    The last argument is optional, so you can just leave it off/drop it altogether.

    Note that you will probably want a date/timestamp in your file name so you don't keep overwriting the file (they way you have it written, you will just keep overwriting the old file with the new file).
    So maybe something like this:
    Code:
    Private Sub btnResults_Click()
        Dim strPathAndFile As String
        strPathAndFile = "C:\Users\Home7\Documents\Vote Reports\Vote Report" & Format(Now(),"yyyymmdd_hhmmss")  & ".pdf"
        DoCmd.OpenReport "rptVoteSummary", acViewPreview
        DoCmd.OutputTo acOutputReport, "rptVoteSummary", acFormatPDF, strPathAndFile, True
    End Sub
    Note that it is not necessary to open the report to export it. So unless you are opening it for the person to view, you can actually remove that line.

    Also note how Access run reports. It does not actually physically store a report with data hard-coded in it. All reports are dynamic and generated at run-time, based on the parameters. So it is not like "reports are lost" from day-to-day. You can run a report for any day at any time if you change the parameters.

  9. #9
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2002
    Join Date
    Jan 2017
    Posts
    57
    How can I go back a get a report from 3/08/17. I can't edit the date box in the Report Button. It always shows today's date.

  10. #10
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2002
    Join Date
    Jan 2017
    Posts
    57
    I get Run Time Error 2282

    'The formats that enable you to output the data as a Microsoft Excel rich text format, MSDOS text or HTML file are missing from the Windows Registry.'

    Also I used "PDFFormat(*.pdf)" instead of acFormatPDF, because the latter gave me an error.

  11. #11
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2002
    Join Date
    Jan 2017
    Posts
    57
    I am running Access 2002. Here is a list of Formats supported by later versions of Access.

    Const acFormatASP = "Microsoft Active Server Pages (*.asp)"
    Const acFormatDAP = "Microsoft Access Data Access Page (*.htm; *.html)"
    Const acFormatHTML = "HTML (*.html)"
    Const acFormatIIS = "Microsoft IIS (*.htx; *.idc)"
    Const acFormatRTF = "Rich Text Format (*.rtf)"
    Const acFormatSNP = "Snapshot Format (*.snp)"
    Const acFormatTXT = "MS-DOS Text (*.txt)"
    Const acFormatXLS = "Microsoft Excel (*.xls)"


    These are Access 2010 file formats: Const acFormatHTML = "HTML (*.html)"
    Const acFormatPDF = "PDF Format (*.pdf)"
    Const acFormatRTF = "Rich Text Format (*.rtf)"
    Const acFormatSNP = "Snapshot Format (*.snp)"
    Const acFormatTXT = "MS-DOS Text (*.txt)"
    Const acFormatXLS = "Microsoft Excel (*.xls)"
    Const acFormatXLSB = "Microsoft Excel Binary Workbook (*.xlsb)"
    Const acFormatXLSX = "Microsoft Excel Workbook (*.xlsx)"
    Const acFormatXPS = "XPS Format (*.xps)"

    I don't seem to be able to get an output in any Format using Access 2002.

  12. #12
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2002
    Join Date
    Jan 2017
    Posts
    57
    I do get an output in my Output File Folder from Adobe Reader. It states the PDF file type is unsupported. I get that message no matter which format I specify.

  13. #13
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2002
    Join Date
    Jan 2017
    Posts
    57
    My conclusion is that my version of Access does not support any report output formats.

    I still need to back up the date to get a previous report. I can do a Print Screen, and paste it into Word.

  14. #14
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    2002 did not natively support PDF. Many of us used this:

    http://www.lebans.com/reporttopdf.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  15. #15
    Dan Lee is offline Advanced Beginner
    Windows 10 Access 2002
    Join Date
    Jan 2017
    Posts
    57
    I found out how to go back to previous report dates. I used a Parameter Query in the Total Vote Query, so it found the report for that date in question, instead of the current date. This will help, but I really want a PDF generated for each report. I need to update my copy of Access.

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

Similar Threads

  1. Newly created report is lost
    By Skydiver16 in forum Reports
    Replies: 2
    Last Post: 02-16-2017, 03:36 PM
  2. So Lost!!
    By pshoestir in forum Programming
    Replies: 6
    Last Post: 08-29-2015, 10:40 PM
  3. lost table
    By J Foley in forum Access
    Replies: 1
    Last Post: 12-22-2014, 04:23 AM
  4. i have lost everything!!!
    By ariansman in forum Access
    Replies: 3
    Last Post: 08-24-2014, 12:18 AM
  5. Lost report formatting
    By kiltedcueball in forum Database Design
    Replies: 2
    Last Post: 06-23-2009, 12:28 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
  •  
Other Forums: Microsoft Office Forums