Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    File Name Using Now() (XP)

    I have an issue where I print to text files using the NOW() function as the filename. I replace the "/" and ":" with a "." so that the file naming convention is valid. I have files created within the same time frame ie it is possible that two files have the same filename down to the second. Is it possible to include milliseconds in the NOW() function?

    Thanks,
    John

  2. #2
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: File Name Using Now() (XP)

    Solution: oStamp = Format(Now(), "MMDDYY ") & Format(Now(), "HH:MM:SS:MS")

  3. #3
    2 Star Lounger
    Join Date
    Sep 2003
    Location
    Louisville, Kentucky, USA
    Posts
    134
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: File Name Using Now() (XP)

    I wouldn't even mention this except that it appears that millisecond precision is important to you. You're using two instances of the NOW() function. Each will return a slightly different value since they are evaluated at slightly different times. It's conceivable that if your statement is executing at midnight, the date and time in your filename will be from different days. You might want to combine all of the formatting codes into one statement:

    oStamp = Format(Now(), "MMDDYY HH:MM:SS:MS")

Posting Permissions

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