Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2008
    Location
    Missouri
    Posts
    8

    Thumbs up Unanswered: Access 2007 Export File and name it a Now() date + "filename"

    I need to name an export file on a daily basis that will generate a new name each day by adding todays date to the front of the name. These are deposits that are imported in an accounting application and I need to keep a history and not overwrite the file each time. I have used Access 2003, but now I am using 2007 and used this new save export feature. Not sure that was a good idea, but I can add it to a macro pretty easily.

    Thanks

  2. #2
    Join Date
    Feb 2004
    Posts
    214

    ...

    Dim mnth As String
    Dim dy As String
    Dim yr As String

    Dim file_nme As String

    mnth = Month(Now())
    dy = Day(Now())
    yr = Year(Now())



    file_nme = "c:/" + mnth + "-" + dy + "-" + yr + ".xls"


    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Your Table Name", [file_nme]
    You know, I'm sick of following my dreams, man. I'm just going to ask where they're going and hook up with 'em later

  3. #3
    Join Date
    Nov 2008
    Location
    Missouri
    Posts
    8

    Naming a file on the fly, It Worked Perfectly

    Now I just have to figure out how to make it a .txt tabbed delimeted with out text qualifiers.

    Thanks again..

  4. #4
    Join Date
    Feb 2004
    Posts
    214

    Talking ...

    You can modify the code to transfertext instead of spreadsheet.
    I beleive you will have to manually export the table through the file menu and create a shema file to make delimit it the way you want, but it shouldn't be too hard.

    Glad I could help
    You know, I'm sick of following my dreams, man. I'm just going to ask where they're going and hook up with 'em later

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    dim strOutut as string
    'open the file
    'open the recordset
    strOutput = mynumericcolumn1 & vbtab & mynumericcolumn2 & vbtab & chr$(34) & mystringcolumn1 & chr$(34).......
    'write strOutput to file.

    but personally id export he file from access and then rename it.
    you could even do that from within access as apart of a macro, export the fiel, then run a vbscript that renames the file formt heknown nal to the required name
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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