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?
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?
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.
I would like to have the program generate a PDF and store it in a file, every time a report is produced.
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.
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.
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.
Try: DoCmd.OutputTo acOutputReport, "rptVoteSummary", acFormatPDF, strPathAndFile = "C:\Users\Home7\Documents\Vote Reports\Vote Report.pdf"
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:
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.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
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.
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.
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.
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.
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.
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.
2002 did not natively support PDF. Many of us used this:
http://www.lebans.com/reporttopdf.htm
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.