It's so simple- but why not?

MCantu

Registered User.
Local time
Today, 09:22
Joined
Nov 18, 2004
Messages
62
Question, why would this work:

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "import Table", "C:\Temp\somefile.xls", True

And this does not?
Dim Fpath As String
Dim Fname as string
Fname=”somefile.xls”
Fpath = "C:\Temp\" & fname

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "import Table", Fpath,True


The only difference is that I am using a variable for the file path.
I have a list of excel files I want to upload and append.


Will this never work- not designed to do it this way- or am I just doing something wrong?

Thanks for any help.
 
Should work, what error message does it give you?
 
Just tried it and it worked fine in Access 2002. The only thing I noticed when I copied your code was the funny quotes in [Fname=”somefile.xls”]. I had to replace them with ["].
 
It was saying that the file name or path does not exsist.

I checked. (including looking for bad characters, an extra space, etc on the path information)

Time to go home for the day. *sigh*

When I tried this (on diffferent databases), I have ALWAYs gotten this response. Same response. I don't think I could have typed the path in wrong all those times, all those different paths.


sorry- Access 2000- does that shine any light on it?
 
Try stepping thru the code and see what Fpath evaluates to.
 

Users who are viewing this thread

Back
Top Bottom