Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Mar 2004
    Location
    Cincinnati, Ohio, USA
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Output TO: (A2K)

    Try this:

    <pre>Dim strMonth as Date, strDate As Date
    Dim strFileName As String, strDir as String

    strDir = "FatabasesBehavioral_HealthBHReportsMthReports30Day"

    strMonth = DateSerial(Year(Date), Month(Date) - 1, 1)
    strDate = Format(strMonth, "mm yy")
    strFileName = "r_MTH_DX_ALOS_" & strDate & ".snp"

    DoCmd.OutputTo acReport, "r_MTH_DX_ALOS", "SnapshotFormat(*.snp)", strDir & strFileName, False, ""
    </pre>


  2. #2
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Output TO: (A2K)

    Edited by HansV to break very long line - please pay attention to the instructions displayed in red when you use <!t>[pre]<!/t> tags.

    Good Morning,

    I have several reports that will get exported monthly and quarterly. Since the users will be saving the reports, I want to include the month as part of the name. i.e. if the report is for Aug. 06, the ending part of the report will be 0806, if Sept. 06, then 0906, and so on.

    So....I have the following code that should (and almost does) what I want it to do. I must be missing something very small because when it exports, it exports as "strFileName.snp" and when I tried it with the remmed line, it exports it w/o an extension or name.

    <pre>Dim strMonth
    Dim strDate As Date
    Dim strFileName As String

    strMonth = DateSerial(Year(Date), Month(Date) - 1, 1)
    strDate = Format(strMonth, "mm yy")
    'strFileName = "r_MTH_DX_ALOS_" & strDate & ".snp"
    strFileName = "r_MTH_DX_ALOS_0806"

    DoCmd.OutputTo acReport, "r_MTH_DX_ALOS", "SnapshotFormat(*.snp)", _
    "FatabasesBehavioral_HealthBHReportsMthReports30Days trFileName.snp", False, ""
    </pre>



    I would love some suggestions....and Thanks.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •