Saving reports in Word on specified paths

driver7408

Registered User.
Local time
Today, 02:18
Joined
Feb 7, 2010
Messages
72
I m new to this and have scoured this forum with no avail. I have a report that a user can generate, showing all of the files he's read and the dates he read them, which works perfectly. I want to create a macro that will output to the report to an .rtf file, save the file, and then open the file in Word. Problem is, that I want it to save it on a path to a common folder and have Access save it in that folder as a new file using the primary key (which is the last four of the user's ssn, or can be their last name) as the name of the file. That way each time they update the information and save the report, it will overwrite the previously generated save file, yet it will be stored in the folder under their name/ or last fouras well.

So far, I can get it to save and open the file, but using the macro I can only save each form under one single path and filename (under the "Output File" string)
 
I don't use macros, but in code you can do this type of thing:

DoCmd.OutputTo acOutputReport, "rptBooking", acFormatPDF, "\\ServerName\FolderName\Test" & Me.ControlName & ".pdf"

If the control contained "1234", the file would be named "Test1234.pdf", and would be on the specified folder on the server.
 
Private Sub Command13_Click()
DoCmd.OutputTo acOutputReport, "rptFileValidator", acFormatRTF, "C:\Users\Brian\Documents\readingfiletest" & LastFourID & ".rtf"

End Sub


Not sure what I am doing. It acts like it is saving but I see nothing in the folder upon checking it. The LastFourID is the reference to the last four field of the ssn, which is on the report. The name of the report is rptFileValidator. This is all new to me and I somehow cannot make sense out of it.
 
You can see the output box flashing by? Or do we need to make sure the code is running at all? Can you post the db? I use dynamic naming like that fairly often, and I know it works.
 
Ok, figured it out, sorta. It was saving it, but not in the folder "readingfiletest." It was saving it in my documents and naming it "readingfiletest" and overwriting itself still (wasnt adding the last fourID after it.) I added a backaslash in the code after readingfiletest:

DoCmd.OutputTo acOutputReport, "rptFileValidator", acFormatRTF, "C:\Users\Brian\Documents\readingfiletest\" & LastFourID & ".rtf"

Now its saving it in the readingfiletest folder, but with no name next to the document icon, and I cannot access the document either.

I'm at work right now, but I'll post the db when I get home, as this computer (gov't computer) is useless for uploading file attachments.

Thanks for the help!
 
Ok, I figured it out and it works great now. For some reason it wouldnt reference the lastfourID, but woulf with the last name. Think it was due to my field structure.

Thanks so much for the assistance.
 
No problem, glad you got it sorted out.
 

Users who are viewing this thread

Back
Top Bottom