Strange behaviour

  • Thread starter samotek via AccessMonster.com
  • Start date
S

samotek via AccessMonster.com

I want to export all queries as follows
Dim FrontDB As DAO.Database, BackDB As DAO.Database, Qry As QueryDef
Set FrontDB = CurrentDb
Set BackDB = OpenDatabase("C:\BE\MGP\Survey\Survey.mdb")
For Each Qry In FrontDB.QueryDefs
DoCmd.TransferDatabase acExport, "Microsoft Access", BackDB.Name, acQuery,
Qry.Name, Qry.Name
Next
BackDB.Close
FrontDB.Close


However I get the error that the path is not found. However the path is true,
I do not know why this error occurs.
For example the fllowing line is OK :
DoCmd.TransferDatabase acExport, "Microsoft Access", "C:\BE\MGB\Survey\Survey.
mdb", acModule, "mdlupsize", "mdlupsize"

Why it is Ok in the second example but not in the first I do not know. It is
very strange. Do you have any explanation ?
 
C

Chris O'C via AccessMonster.com

You have a typo in the first example. "C:\BE\MGP\Survey\Survey.mdb" should
be "C:\BE\MGB\Survey\Survey.mdb".

Chris
Microsoft MVP
 
D

Douglas J. Steele

There's no point to BackDB. In fact, it could cause problems using it, since
it's creating an additional connection to the database that could cause
contention.

Just use

DoCmd.TransferDatabase acExport, "Microsoft Access",
"C:\BE\MGB\Survey\Survey.mdb", acModule, Qry.Name, Qry.Name
 

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