Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2004
    Location
    New Hampshire Coast
    Posts
    18

    Arrow Unanswered: save report with date in file name

    hi all,

    i've been trying to save a report file using this statement:

    DoCmd.OutputTo acOutputReport, "Outstanding Census Summary by ASM", acFormatSNP, "\\network file system\Outstanding Census Summary" & Date & ".snp", , , False

    when i run this, i get the run time error 2024 "The report snapshot was not created because you don't have enough free disk space for temporary work files".

    i looked at the MS web site and it says to remove invalid characters.

    so how do i get a date in the file name?

    i want to run this daily and have a report with the date in the name for each day:
    Report031704.snp
    Report030804.snp
    etc.

    thanks in advance for your help!

  2. #2
    Join Date
    Nov 2002
    Location
    The Netherlands
    Posts
    61
    Isn't this a disk space error ?
    Maybe you dont have enough disk space on the disk.

  3. #3
    Join Date
    Mar 2004
    Location
    New Hampshire Coast
    Posts
    18
    When I remove the logic to try to append the date, this statement works. I think it might be something to do with the slashes in the date? how can i format this to just use MMDDYYYY instead of mm/dd/yyyy in the name of the file?

    Thanks!
    Originally posted by DeathWing
    Isn't this a disk space error ?
    Maybe you dont have enough disk space on the disk.

  4. #4
    Join Date
    Nov 2002
    Location
    The Netherlands
    Posts
    61
    This might help?
    First it finds out where the slashes are so it can get the right values. Then it gets the Month day and year.
    If you want to check with an number is below 10 use the if statement with that. It will show dates like this 03182004.

    Mystring = Date
    slash1 = InStr(1, Mystring, "/")
    slash2 = InStrRev(Mystring, "/")

    A = Left(Mystring, slash1 - 1)
    If A<10 then
    A="0"+A
    end if

    B = Right(Mystring, slash2 - 1)
    if B<10 then
    B="0"+B
    end if

    C = Mid(Mystring, slash1 + 1, 2)
    DoCmd.OutputTo acOutputReport, "Outstanding Census Summary by ASM", acFormatSNP, "\\network file system\Outstanding Census Summary" & A+B+C & ".snp", , , False
    Last edited by DeathWing; 03-18-04 at 11:09.

  5. #5
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    or you could use the new replace function that comes with VB6

  6. #6
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    go to this site:
    http://www.kode-fu.com/rosetta/string_funcs_main.html

    it has all the string manipulation functions u'll ever need; one of the best for VB programmers

  7. #7
    Join Date
    Nov 2002
    Location
    The Netherlands
    Posts
    61
    But is it availiable in VBA?

  8. #8
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    yup; dim something as string;
    something.replace(contents, "/")

  9. #9
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    sorry that was the wrong usage;
    Replace(myString, searchString, replacementString)

    and replacement string would be ""

Posting Permissions

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