Transfer to a file using current 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
 
D

Dirk Goldgar

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top