Transfer Database is not doing what I want

  • Thread starter Thread starter Treebeard
  • Start date Start date
T

Treebeard

I want to take one of my tables and create a new mdb file that has only that
table in. I tried this:

DoCmd.TransferDatabase acExport, "Microsoft Access", strDBExportName,
acTable, ContactExportTableName, ContactExportTableName, False

Where strDBExportName = "C:\DB\MY_EXPORT.MDB"

But it doesn't work unless the MY_EXPORT.MDB file is already there . In
other words I want it to work like TranserText which creates the destination
file automatically.

Thanks,

Jack
 
Jack,

AFAIK, you can only use TransferDatabase with an existing database.

I would create a new database first using the CreateDatabase method. Access
help should give you the correct syntax along with examples on how to use
it..

HTH.

Nick
 
Try this
Basically, you need to have a database before you can do anything with
it.

Rodrigo.

Sub test()
On Error Resume Next
Dim db As DAO.DATABASE
Dim strDBExportName As String

strDBExportName = "C:\MY_EXPORT.MDB"

Kill strDBExportName
Set db = CreateDatabase(strDBExportName, dbLangGeneral)

DoCmd.TransferDatabase acExport, "Microsoft Access", strDBExportName,
acTable, "ContactExportTableName", "ContactExportTableName", False

End Sub
 
Rodrigo

I begging for you help again. I've tried to modify some code you gave me to create a list displaying tables in a database. I've posted under Programming, message Title "using a form to show a list of tables" date 3/15

If you have any tips, I'd be most grateful

Thanks
 
I posted a reply to your message.
laura Reid said:
Rodrigo,

I begging for you help again. I've tried to modify some code you gave me
to create a list displaying tables in a database. I've posted under
Programming, message Title "using a form to show a list of tables" date
3/15.
 
Back
Top