My Assistant
![]()
Custom Search
|
![]() ![]() |
![]() |
![]() Post#1 | |
Posts: 12 Joined: 12-October 19 ![]() | I have upgraded to use the inbuild PDF printing function and use the following code to print out a PDF. There is a check button of the form from which the PDF is printed. Private Sub cmdPrintStatement_Click() If CheckPDF.Value = True Then DoCmd.OpenReport "rpt229PDF", acViewPreview, , , acHidden DoCmd.OutputTo acOutputReport, "rpt229PDF", acFormatPDF, "" & Company & ".pdf" DoCmd.Close acReport, "rpt229PDF", acSaveNo End If If CheckPDF.Value = False Then DoCmd.OpenReport "rpt229" End If End Sub All works fine but whichever way I try, I cannot get a month and year to appear after the customers name. (there is a date field on the form,though it may be referable to use some form of Date() function. I always seem to have to many or not enough "" marks. Any clues? I dont need a file path as the software is on three different computers and have simple told the database to upload files to a new default folder at C:\V-Tech\PDF Documents |
![]() Post#2 | |
Posts: 1,015 Joined: 25-January 16 ![]() | Simply concatenate. DoCmd.OutputTo acOutputReport, "rpt229PDF", acFormatPDF, Me.Company & "_" & Format(Date(), "yyyymm") & ".pdf" This post has been edited by June7: Nov 27 2019, 06:43 PM -------------------- Attachments Manager is below the edit post window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. DEBUG! DEBUG! DEBUG! http://www.cpearson.com/Excel/DebuggingVBA.aspx |
![]() Post#3 | |
Posts: 12 Joined: 12-October 19 ![]() | Cheers works perfectly though I just changed yyyymm to mmyy. Next question, how to I get for the 11th month to print out Nov? |
![]() Post#4 | |
Posts: 6,182 Joined: 11-November 10 From: SoCal, USA ![]() | well, generically, Format(Date(), "mmmyy") should do it. but if you only want the "short name" to be used when it's Nov, that takes a bit more work. hth tina -------------------- "the wheel never stops turning" |
![]() Post#5 | |
![]() Posts: 345 Joined: 21-September 14 From: Tampa Bay, Florida, USA ![]() | Just the 11th month?.. Well, all months would display three-letter abbrevs with: Format(Date(), "MMMyyyy") if you want the first letter of the abbrev in uppercase. This post has been edited by FrankRuperto: Nov 27 2019, 07:09 PM -------------------- Currently supporting pawnbrokers that use my store management system developed with Access 2010 on Windows7. Experienced with Informix and Oracle DB's. |
![]() Post#6 | |
Posts: 12 Joined: 12-October 19 ![]() | Absolutely brilliant. Changed to Date function to MMMyy and it works. I now get customername-NOV19.pdf as the file name. Thank you all. |
![]()
Custom Search
|
![]() | Search Top Lo-Fi | 10th December 2019 - 08:47 AM |