Transfer Database is not doing what I want

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
 
N

NH

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
 
R

Rodrigo

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
 
G

Guest

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
 
R

Rodrigo

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.
 

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