TransferSpreadsheet code with date?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: TRob (anonymous_at_discussions.microsoft.com)
Date: 06/16/04


Date: Wed, 16 Jun 2004 10:08:21 -0700

version: Access 97
I have placed a command button on a form for archiving
data that exports to the user's hard drive. Code is:

DoCmd.TransferSpreadsheet acExport,
acSpreadsheetTypeExcel97, "qryArchive", "C:\CyberImport\Arc
hived.xls", True

Users are not techie savy, so it's difficult to explain
they'll need to change the name of the file on the hard
drive before clicking the command button again since it
will overwrite the original file. They will not be doing
this often and I will not be around to support this when
they want to do it again.

Is there any way to alter the code so that the current
date is stored in the filename? For example:

C:\CyberImport\Archived_061604.xls
C:\CyberImport\Archived_073104.xls
C:\CyberImport\Archived_093004.xls

I tried:
DoCmd.TransferSpreadsheet acExport,
acSpreadsheetTypeExcel97, "qryArchive", "C:\CyberImport\Arc
hived&Now().xls", True

But, of course, all that did is create a file
named "C:\CyberImport\Archived&Now().xls". I know, I
know. I had to just try it.

Thanks!



Relevant Pages

  • TransferSpreadsheet to Excel limit
    ... I have the following command in a form ... DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, ... It only exports 16,384 rows. ...
    (microsoft.public.access.formscoding)
  • How to link in static objects from a static library?
    ... files that all contain static "registrar" objects in certain classes. ... In particular, I have a templated Registrar class, and each of the ... ..o files that I am archiving, ... Link command that explicitly lists .o files: ...
    (comp.os.linux.development.system)
  • Re: Link error with gcc - undefined symbol
    ... this is some good information - especially the dump -Tv ... added -bexpall to the gcc command to force the exports. ... Is using an export list really a viable option to pursue? ...
    (comp.unix.aix)
  • Re: Export data from current record to csv
    ... criteria is to return only the record being displayed on the form? ... One approach might be to create a query that uses a Selection Criterion to ... I want to add a command button to a form so that when a user clicks it ... Can I run a command that just exports the relevant fields from the ...
    (microsoft.public.access.externaldata)
  • Re: Export data from current record to csv
    ... One approach might be to create a query that uses a Selection Criterion to ... Microsoft Office/Access MVP ... I want to add a command button to a form so that when a user clicks it ... Can I run a command that just exports the relevant fields from the ...
    (microsoft.public.access.externaldata)