DoCmd.TransferDatabase to DBase III - how

Can anyone tell me what is wrong with the following code. When I run it from I get a message to say that
"C:\Documents and Settings\Rob\My Documents\MyDatabase.accdb is not a valid path.  Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides." If I run it manually it works fine.

DoCmd.TransferDatabase acExport, "dBase III" _
      , CurrentDb.Name, _
      acTable, _
      "tblTempOutput", _
      "C:\Documents and Settings\Rob\My Documents\Out.dbf"
LVL 1
Rob4077Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
1. <When I run it from I get a message >
When you run it from what?

<If I run it manually it works fine.>
As far as I know, there is only one way to "Run" code.
Can you explain what this means?

3. Is the code you posted the code that works, or the code that does not work?

First let's get rid of the line contiuation charachters so we can see if this doesn't have anything to do with the error.
Then try this (the attached snippet) just as a test, to see if it is just not liking the spaces in the path:

JeffCoachman
DoCmd.TransferDatabase acExport, "dBase III", CurrentDb.Name, acTable, "tblTempOutput", "C:\Out.dbf"

Open in new window

0
Jeffrey CoachmanMIS LiasonCommented:
Then try this:
(Perhaps we can get around it by using the Dos 8.3 syntax:
DoCmd.TransferDatabase acExport, "dBase III", CurrentDb.Name, acTable, "tblTempOutput", "c:\Docume~1\Rob\MYDOCU~1\Out.dbf

Open in new window

0
Jeffrey CoachmanMIS LiasonCommented:
sorry, forgot the last "

DoCmd.TransferDatabase acExport, "dBase III", CurrentDb.Name, acTable, "tblTempOutput", "c:\Docume~1\Rob\MYDOCU~1\Out.dbf"

Open in new window

0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Rob4077Author Commented:
Hi Jeff,
First I will answer your questions:
1. <When I run it from I get a message > When you run it from what?
I created a Sub in a module of the database that contains the table I want to transfer from and I step through the code pressing the F8 key. When it gets to that line it jumps to the error handler with the described message

<If I run it manually it works fine.>
As far as I know, there is only one way to "Run" code. Can you explain what this means?
Badly worded, sorry. If I manually transfer the table using the menu options in MS Access 2007 External Data>Export>More>DBase file .... the file exports perfectly

3. Is the code you posted the code that works, or the code that does not work?

 The code I posted is the code that doesn't work. Your code (both variants) comes up with the same error. Please note that the file described by the error message as being invalid is the file location of CurrentDb.name. That name is managed by MS Access so I don't understand how it can be wrong. The table name is correct as I have copy and pasted it to ensure it is spelled correctly.
0
Jeffrey CoachmanMIS LiasonCommented:
The try fully qualifying it:

DoCmd.TransferDatabase acExport, "dBase III", "C:\YourFolder\YourDatabase.mdb", acTable, "tblTempOutput", "C:\Out.dbf"
 

DoCmd.TransferDatabase acExport, "dBase III", "C:\YourFolder\YourDatabase.mdb", acTable, "tblTempOutput", "C:\Out.dbf"

Open in new window

0
Rob4077Author Commented:
I had already tried that but got the same error message. I even tried a decompile in case there was a problem at a lower level
0
Jeffrey CoachmanMIS LiasonCommented:
OK

1. What happens if you change the format to "Microsoft Access"

2. You may need to Re-install Accessmaking *sure* you do a full install.
(to make sure the DBase components are installed.)
0
Rob4077Author Commented:
I tried changing the format change as suggested and irrespective of whether I use "C:\Out.dbf" or "C:\Out.mdb" or "C:\Out.accdb" the error message I get is that the file name doesn't conform to Microsoft naming conventions.
I fear you may be right in that I need to do a complete re-install.  It's odd, though, that it works fine when I use the manual method using the menus.
0
Rob4077Author Commented:
I tried another web site and found the solution, which implies the help is wrong. When I changed the code to the following it worked perfectly.
DoCmd.TransferDatabase acExport, "dBase III", "C:\",, "tblTempOutput", "Out.dbf"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
Interesting...

You can now accept your own post: 24502336, as the solution

;-)
0
Rob4077Author Commented:
Thanks for your time trying to help on this one. I would never have expected MS Access help to be wrong!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.