Transfer to a file using current Date

  • Thread starter Thread starter David
  • Start date Start date
D

David

If some could help me with this. I would like to use the
Transferdatabase command in a a close expression. What
I'm trying to do is have the the database export and
create a file with the current date has it's filename. I
have tried to do this and have not been sucessfull yet.

Thanys for any help in advanced.
David
 
David said:
If some could help me with this. I would like to use the
Transferdatabase command in a a close expression. What
I'm trying to do is have the the database export and
create a file with the current date has it's filename. I
have tried to do this and have not been sucessfull yet.

Thanys for any help in advanced.
David

TransferDatabase won't create the database, AFAIK; you have to create
the database first, then import into it. You might use code like this:

Dim db As DAO.Database
Dim strDBName As String

strDBName = "C:\My Path\" & Format(Date, "yyyymmdd") & ".mdb"

Set db = DBEngine.CreateDatabase(strDBName, dbLangGeneral)
db.Close
Set db = Nothing

DoCmd.TransferDatabase _
acExport, _
"Microsoft Access", _
strDBName, acTable, _
"Table1", _
"Table1"
 
Back
Top