Export Works in Step Mode, Fails when Run

  • Thread starter Thread starter alr
  • Start date Start date
A

alr

Guest
Hi All,

When I run the code containing the line below in (Access 03) my procedure and step through each line it runs perfectly.

DoCmd.TransferDatabase transfertype:=acExport, databasetype:="Microsoft Access", _
databasename:=strDB & strWkOrd & strCaseCode & ".mdb", _
objecttype:=acTable, SOURCE:="WkDt", _
Destination:="WkDt", structureonly:=False

When I take out the break point and let it run from a button I get the following error message.

"Cannot open database 'U:\tst1\99999test1.mdb'. It may not be a database that your application recognizes, or the file may be corrupt."

The database named is the destination for the export. If I try the export manually to the same file, it works every time. Any idea what could be going on here?

Thanks,

alr
 
Try filling in your databasename variable before you run the function.

Dim databasename as String

databasename = strDB & strWkOrd & strCaseCode & ".mdb"

DoCmd.TransferDatabase acExport, "Microsoft Access", databasename, acTable, "WkDt","WkDt", False
 
Answer Found

Hi x0reset,

Thanks very much for taking a look at this!

I had created the mdb first and while I had the statement
"appAccess=nothing", I was missing the required "appAccess.quit"

Now things run perfectly but I am still curious how the thing ran in step mode but errored out when run from the form. I guess there is something different that I have not encountered before.

Thanks again,

alr
 

Users who are viewing this thread

Back
Top Bottom