Re: Export to Specific Folder Based on Report Field?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Brook:

If you take a look at our PDF and Mail Library it can help you automate this
process, you'll find it on our web site in the developer tools area. To
determine if a file already exists, before you output it, you can use the
DIR vba command, then change the target output file name.

Hope that helps
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

"Brook" <Brook@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BE211EAE-0968-4BE3-82B3-DD7BF5F855A4@xxxxxxxxxxxxxxxx
> Good Day,
>
> I have an orders form that I use for two types of orders: Custom &
> Program, after an order is input, I click a button that prints my order
> form
> & saves it to a specified folder. However at this point all my order forms
> go
> to one folder. I would like to have it set up so that if it is custom
> order
> it is saved to C:\Custom Orders and if it is a Program Order it is saved
> to
> folder C:\Program Orders.
>
> Also, I would like to have the code set up so that if the the file name
> already exist, it won't overright the file, but add a new file with an
> added
> extension of some sort? I.E. if the file is CustomOrder_08 and I tried to
> export the same order form again it would add an extension like
> CustomOrder_08_1 and so on... Any ideas? suggestions?
>
> IF anyone has any ideas on how to incorporate the ability to save as a
> PDF
> please let me know... I have Adobe Acrobat Professional.
>
> Thanks,
>
> Brook
>
> Below is my current code:
>
> Start Code:
>
> Private Sub cmdPrintPreview_Click()
>
> Dim strReportName As String
> Dim strCriteria As String
> Dim strOutputName As String
>
> Me.Dirty = False
>
> If NewRecord Then
> MsgBox "This record contains no data. Please select a record to
> print or Save this record." _
> , vbInformation, "Invalid Action"
> Exit Sub
> Else
> strReportName = "rptcustomorders"
> strCriteria = "[orderid]= " & Me![orderid]
>
> DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
>
> If MsgBox("Do you want to save the report to disk?", vbYesNo +
> vbQuestion, "Save Report") = vbYes Then
>
> strOutputName = "D:\Karma Imports\Program & Custom Orders\Custom
> Orders\" & (Me!ordnum) & " - " & Format(Date, "mm_dd_yyyy") & ".snp"
>
> If Me.PrintOrder = False Then
> Me.PrintOrder = True
> Me.SystemPrintDate = Date
> End If
>
>
> DoCmd.OutputTo acOutputReport, strReportName, acFormatSNP,
> strOutputName, True
> End If
>
> End If
> End Sub
>
>
> End Code


.



Relevant Pages

  • Re: Execute macro for all documents in the folder
    ... It is simple enough to batch process a single folder. ... Dim strFileName As String ... It seems as though the below macro from an earlier posting was put ...
    (microsoft.public.word.docmanagement)
  • Re: Execute macro for all documents in the folder
    ... It is simple enough to batch process a single folder. ... Dim strFileName As String ... It seems as though the below macro from an earlier posting was put ...
    (microsoft.public.word.docmanagement)
  • Re: Snapshot to pdf code
    ... Dim strDocName As String ... ' Save the Report as a PDF document. ... ' The selected report is first exported to Snapshot format. ...
    (microsoft.public.access.reports)
  • RE: Looping Macro - Run Time Error
    ... The macro allows the user to select the folder containing the most up to ... Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) ... Dim strWSName As String ... 'Switch on auto calculation ...
    (microsoft.public.excel.programming)
  • Re: Execute macro for all documents in the folder
    ... It is simple enough to batch process a single folder. ... Dim strFileName As String ... It seems as though the below macro from an earlier posting was put ...
    (microsoft.public.word.docmanagement)