Error on export query

T

Tim

Hi folks,

I have the following code to create a new database called test.mdb and
transfer a table, table1, to the database. Some time, it works fine but some
time it gives me the error message “Run – Time error ‘3049’. Cannot open
databaseâ€

Could anyone know the problem and the solution for it?

Any help will be appreciated

Thanks in advance.

Tim.

Public Sub Export()

Dim appAccess As Access.Application
Dim strFileName As String

strFileName = "c:\temp\test.mdb"

Set appAccess = CreateObject("Access.Application.10")
appAccess.NewCurrentDatabase strFileName

Set appAccess = Nothing

DoCmd.TransferDatabase acExport, "Microsoft Access", strFileName, _
acTable, "Query1", "table1", False

End Sub
 

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