Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Sacramento, California, USA
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    OutputTo returning Runtime error '2302' (Access97 (SR2))

    I have some code that I am trying to use to send copies of reports to our server once a month. The final folder in the server path and the last part of the report name are based on the date. I am receiving run-time error 2302 when attempting to run the code (posted below). The error indicates either the file is open, a template problem, or insufficient disk space. None of these are true, so I'm stumped. I'm also relatively new to code, so maybe i've done something that will be evident to one of you incredible experts (I am in awe of the depth of your knowledge!).

    ***START OF CODE***
    Function OutputToDesktop_A()

    ' This function was built to automatically output the monthly RTF files to the
    ' appropriate server location based on current date

    DoCmd.OutputTo acOutputReport, "ALL revenues", acFormatRTF, _
    "Cdssfps03admFiscalSystemsAndAccountingBranchCALST ARSReportsFFY_01_02FM" _
    & DLookup("fmpart", "fm_to_mo", "[datepartmo]=" & DatePart("m", Date)) _
    & "_" & Format(Date - 30, "mmm") & "_" & Format(Date - 30, "yyyy") & "ALL REVENUE_" _
    & Format(Date - 30, "mmmyyyy") & ".rtf"

    End Function
    ***END OF CODE***

    I could get it to work until I put this portion in:
    "DLookup("fmpart", "fm_to_mo", "[datepartmo]=" & DatePart("m", Date)) _
    & "_" & Format(Date - 30, "mmm") & "_" & Format(Date - 30, "yyyy")"

    I can get the proper path back if I paste the "DLookUp" portion of the code into a query and run against a datepartmo table. It returns the following appropriate path:

    "Cdssfps03admFiscalSystemsAndAccountingBranchCALST ARSReportsFFY_01_02FM10_Mar_2002ALL revenues_Mar2002.rtf"

    Hope one of you can help me with this

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OutputTo returning Runtime error '2302' (Access97 (SR2))

    Did the directory already exist on the server ?
    The Docmd.Output will not create it.
    Francois

  3. #3
    Lounger
    Join Date
    Jan 2001
    Location
    Sacramento, California, USA
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OutputTo returning Runtime error '2302' (Access97 (SR2))

    THANK YOU FRANCOIS ! When I read your reply, I thought "of course the folder exists, we've been using them manually for some time"..... I didn't account for a TYPO though! I had one letter off in the server path name.

    Thanks for making me look at it again, in a different light. I'm embarrassed by my lack of attention to detail, and truly appreciate your time.

Posting Permissions

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