From: Reggie on
Hi and TIA! I'm trying to import files into my db. All works well if the
file name has no spaces, but if there are spaces it bombs out. Is this a
common feature or is there a way to allow my uses to import files with
spaces in the file name. Thanks for you time!

--

Reggie

From: John W. Vinson on
On Wed, 17 Mar 2010 14:36:29 -0700, "Reggie" <No_Spam_chief123101(a)yahoo.com>
wrote:

>Hi and TIA! I'm trying to import files into my db. All works well if the
>file name has no spaces, but if there are spaces it bombs out. Is this a
>common feature or is there a way to allow my uses to import files with
>spaces in the file name. Thanks for you time!

Put the filename in quotes. I presume you're using TransferText in VBA code?
If not please explain the context.
--

John W. Vinson [MVP]
From: Reggie on
"John W. Vinson" <jvinson(a)STOP_SPAM.WysardOfInfo.com> wrote in message
news:gut2q59tdlivj7llroj5bic2q56pa058v8(a)4ax.com...
> On Wed, 17 Mar 2010 14:36:29 -0700, "Reggie"
> <No_Spam_chief123101(a)yahoo.com>
> wrote:
>
>>Hi and TIA! I'm trying to import files into my db. All works well if the
>>file name has no spaces, but if there are spaces it bombs out. Is this a
>>common feature or is there a way to allow my uses to import files with
>>spaces in the file name. Thanks for you time!
>
> Put the filename in quotes. I presume you're using TransferText in VBA
> code?
> If not please explain the context.
> --
>
> John W. Vinson [MVP]

John, Sorry I wasn't more specific. Here's the code I am using. Thanks
once again for you time and help.

Dim strTable As String
Dim strfilter As String

strTable = "tblAMCR_Import_Temp"
strfilter = ""
strfilter = OpenFileExt(strfilter, "Excel Files(*.XLS)", "*.XLS")
If IsNull(strfilter) Then
Exit Sub
Else
DoCmd.TransferSpreadsheet acImport, , strTable, strfilter, False
End If


--

Reggie

From: John W. Vinson on
On Thu, 18 Mar 2010 00:05:41 -0700, "Reggie" <No_Spam_chief123101(a)yahoo.com>
wrote:


>
>John, Sorry I wasn't more specific. Here's the code I am using. Thanks
>once again for you time and help.
>
>Dim strTable As String
>Dim strfilter As String
>
>strTable = "tblAMCR_Import_Temp"
> strfilter = ""
> strfilter = OpenFileExt(strfilter, "Excel Files(*.XLS)", "*.XLS")
> If IsNull(strfilter) Then
> Exit Sub
> Else
> DoCmd.TransferSpreadsheet acImport, , strTable, strfilter, False
> End If

Now I'm really confused. There are no variable filenames here... do you mean
that it works for tblAMCR_Import_Temp but fails if the filename is

tblAMCR Import Temp.xls

or what?
--

John W. Vinson [MVP]
From: Reggie on
"John W. Vinson" <jvinson(a)STOP_SPAM.WysardOfInfo.com> wrote in message
news:01j4q59j7kv33p75scv843lfrlkunvtfou(a)4ax.com...
> On Thu, 18 Mar 2010 00:05:41 -0700, "Reggie"
> <No_Spam_chief123101(a)yahoo.com>
> wrote:
>
>
>>
>>John, Sorry I wasn't more specific. Here's the code I am using. Thanks
>>once again for you time and help.
>>
>>Dim strTable As String
>>Dim strfilter As String
>>
>>strTable = "tblAMCR_Import_Temp"
>> strfilter = ""
>> strfilter = OpenFileExt(strfilter, "Excel Files(*.XLS)", "*.XLS")
>> If IsNull(strfilter) Then
>> Exit Sub
>> Else
>> DoCmd.TransferSpreadsheet acImport, , strTable, strfilter, False
>> End If
>
> Now I'm really confused. There are no variable filenames here... do you
> mean
> that it works for tblAMCR_Import_Temp but fails if the filename is
>
> tblAMCR Import Temp.xls
>
> or what?
> --
>
> John W. Vinson [MVP]

No. The open file dialog opens (strfilter = OpenFileExt(strfilter, "Excel
Files(*.XLS)", "*.XLS")). The user selects the file (ex. C:\MyFile or
whatever) and this is placed into strfilter(variable file name).
tblAMCR_Import_Temp is the table I am transfering the excel spreadsheet
into. It works if strfilter = C:\MyFile but not if C:\My File.

--

Reggie