From: gmazza via AccessMonster.com on
Hey there,
Instead of changing the code all the time, I stored my path in my table and
am using DLookup to grab the path for Importing.
Here is my code:
strFile = Nz(DLookup("Directory450", "ImportDirectory"))
DoCmd.TransferText acImportDelim, "450ImportSpecs", "450Export", strFile

Here is the value of the field Directory450:
DIR("F:\IT\db\Sales\Archive\450*.csv")

It is failing on my import saying you cannot import this file. I figure it is
because when I debug I see the strFile = "DIR("F:\IT\db\Sales\Archive\450*.
csv")"

It is putting quotes around the value in the table. I don';t think I want
this, any thoughts??
Thanks!!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200911/1

From: Linq Adams via AccessMonster.com on
My guess would be because your file name is

450*.csv

and files names cannot have special characters, such as the asterisk, in them.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200911/1

From: gmazza via AccessMonster.com on
How would I get the filenames then that have characters after the 450. The
characters will change behind the 450 so I want to make sure it grabs them
all.

Linq Adams wrote:
>My guess would be because your file name is
>
>450*.csv
>
>and files names cannot have special characters, such as the asterisk, in them.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200911/1

From: gmazza via AccessMonster.com on
Thats not the problem anyway as I just changed the filename to 450aa.csv
which does exist and it still said you cannot import this file.

Linq Adams wrote:
>My guess would be because your file name is
>
>450*.csv
>
>and files names cannot have special characters, such as the asterisk, in them.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200911/1

From: Douglas J. Steele on
strFile would need to be "F:\IT\db\Sales\Archive\450aa.csv" in that case
(i.e.: you do not want the reference to the Dir function). Is it?

In answer to your other question, you need code like:

Dim strFolder As String
Dim strFile As String

strFolder = ""F:\IT\db\Sales\Archive\"
strFile = Dir(strFolder & "450*.csv")
Do While Len(strFile) > 0
DoCmd.TransferText acImportDelim, "450ImportSpecs", "450Export",
strFolder & strFile
strFile = Dir()
Loop


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"gmazza via AccessMonster.com" <u37142(a)uwe> wrote in message
news:9f8d8a6d9244b(a)uwe...
> Thats not the problem anyway as I just changed the filename to 450aa.csv
> which does exist and it still said you cannot import this file.
>
> Linq Adams wrote:
>>My guess would be because your file name is
>>
>>450*.csv
>>
>>and files names cannot have special characters, such as the asterisk, in
>>them.
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200911/1
>