acImportFixed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi.

I´m trying to import a fixed textfile instead of ; sep.
I have tried ; separated before, and it works.
I took the same code and changed it a little.
I assumed that I would use acImportFixed, instead of ac ImportDelim.

I mostly used the same code for this, as for when I´m importing ; sep. files.
But it wont work with the fixed one.

I have changed the strFile a little though

strfile = Dir("[Forms]![3ExpQFS]![FS].txt")

Is this ok?
Its not highlighted in the debugger.

I get the message
3001 'Invalid argument'

I dont really know why it wont work.
Is there something wrong with my dll-file used for importing?
I have tried making a new one 4 times, but with the same result.

The highlighted part in the debugger is

DoCmd.TransferText acImportFixed, "ImpSpecE4", "3FSSpecImp", strPath & "\" &
strfile

Anything wrong with this code?

Grateful for any hints or answers.

BR
/Claes
 
Are you storing the path and name of the file in [Forms]![3ExpQFS]![FS]
control? If yes, change your code step to this:

strfile = Dir([Forms]![3ExpQFS]![FS] & ".txt")
 
Actually, I only store the filename there.

I tried to change, but got the same message.

Heres most of the code.

Dim Confirm As String
Dim IntOptions As Integer
Dim bytChoice As Byte

Dim strfile As String
Dim strPath As String

strPath = "W:\Apps\Kotten\FDLLEV\"

ChDir strPath

strfile = Dir([Forms]![3ExpQFöljesedel]![Följesedel] & ".txt")

DoCmd.TransferText acImportFixed, "ImportspecifikationExport4",
"3ExpFöljesedelSpecImportTemp", strPath & "\" & strfile




"Ken Snell (MVP)" skrev:
Are you storing the path and name of the file in [Forms]![3ExpQFS]![FS]
control? If yes, change your code step to this:

strfile = Dir([Forms]![3ExpQFS]![FS] & ".txt")


--

Ken Snell
<MS ACCESS MVP>

Claes D said:
Hi.

I´m trying to import a fixed textfile instead of ; sep.
I have tried ; separated before, and it works.
I took the same code and changed it a little.
I assumed that I would use acImportFixed, instead of ac ImportDelim.

I mostly used the same code for this, as for when I´m importing ; sep.
files.
But it wont work with the fixed one.

I have changed the strFile a little though

strfile = Dir("[Forms]![3ExpQFS]![FS].txt")

Is this ok?
Its not highlighted in the debugger.

I get the message
3001 'Invalid argument'

I dont really know why it wont work.
Is there something wrong with my dll-file used for importing?
I have tried making a new one 4 times, but with the same result.

The highlighted part in the debugger is

DoCmd.TransferText acImportFixed, "ImpSpecE4", "3FSSpecImp", strPath & "\"
&
strfile

Anything wrong with this code?

Grateful for any hints or answers.

BR
/Claes
 
You've got doubled up \ characters when you do the TransferText. Here is
your code step:

DoCmd.TransferText acImportFixed, "ImportspecifikationExport4",
"3ExpFöljesedelSpecImportTemp", strPath & "\" & strfile

Note that you're concatenating a \ character into the string for the path
and file name. However, strPath already contains a trailing \ character, so
this concatentation is not needed. Try this:

DoCmd.TransferText acImportFixed, "ImportspecifikationExport4",
"3ExpFöljesedelSpecImportTemp", strPath & strfile

--

Ken Snell
<MS ACCESS MVP>


Claes D said:
Actually, I only store the filename there.

I tried to change, but got the same message.

Heres most of the code.

Dim Confirm As String
Dim IntOptions As Integer
Dim bytChoice As Byte

Dim strfile As String
Dim strPath As String

strPath = "W:\Apps\Kotten\FDLLEV\"

ChDir strPath

strfile = Dir([Forms]![3ExpQFöljesedel]![Följesedel] & ".txt")

DoCmd.TransferText acImportFixed, "ImportspecifikationExport4",
"3ExpFöljesedelSpecImportTemp", strPath & "\" & strfile




"Ken Snell (MVP)" skrev:
Are you storing the path and name of the file in [Forms]![3ExpQFS]![FS]
control? If yes, change your code step to this:

strfile = Dir([Forms]![3ExpQFS]![FS] & ".txt")


--

Ken Snell
<MS ACCESS MVP>

Claes D said:
Hi.

I´m trying to import a fixed textfile instead of ; sep.
I have tried ; separated before, and it works.
I took the same code and changed it a little.
I assumed that I would use acImportFixed, instead of ac ImportDelim.

I mostly used the same code for this, as for when I´m importing ; sep.
files.
But it wont work with the fixed one.

I have changed the strFile a little though

strfile = Dir("[Forms]![3ExpQFS]![FS].txt")

Is this ok?
Its not highlighted in the debugger.

I get the message
3001 'Invalid argument'

I dont really know why it wont work.
Is there something wrong with my dll-file used for importing?
I have tried making a new one 4 times, but with the same result.

The highlighted part in the debugger is

DoCmd.TransferText acImportFixed, "ImpSpecE4", "3FSSpecImp", strPath &
"\"
&
strfile

Anything wrong with this code?

Grateful for any hints or answers.

BR
/Claes
 
Same result anyway.

Could it be that there is something with the dll-file?
I remember reading somewhere that the dll-file or some sort of scheme has to
be placed in the same folder as the file you are importing, when you are
importing fixed files.
Have you heard anything about that?

"Ken Snell (MVP)" skrev:
You've got doubled up \ characters when you do the TransferText. Here is
your code step:

DoCmd.TransferText acImportFixed, "ImportspecifikationExport4",
"3ExpFöljesedelSpecImportTemp", strPath & "\" & strfile

Note that you're concatenating a \ character into the string for the path
and file name. However, strPath already contains a trailing \ character, so
this concatentation is not needed. Try this:

DoCmd.TransferText acImportFixed, "ImportspecifikationExport4",
"3ExpFöljesedelSpecImportTemp", strPath & strfile

--

Ken Snell
<MS ACCESS MVP>


Claes D said:
Actually, I only store the filename there.

I tried to change, but got the same message.

Heres most of the code.

Dim Confirm As String
Dim IntOptions As Integer
Dim bytChoice As Byte

Dim strfile As String
Dim strPath As String

strPath = "W:\Apps\Kotten\FDLLEV\"

ChDir strPath

strfile = Dir([Forms]![3ExpQFöljesedel]![Följesedel] & ".txt")

DoCmd.TransferText acImportFixed, "ImportspecifikationExport4",
"3ExpFöljesedelSpecImportTemp", strPath & "\" & strfile




"Ken Snell (MVP)" skrev:
Are you storing the path and name of the file in [Forms]![3ExpQFS]![FS]
control? If yes, change your code step to this:

strfile = Dir([Forms]![3ExpQFS]![FS] & ".txt")


--

Ken Snell
<MS ACCESS MVP>

Hi.

I´m trying to import a fixed textfile instead of ; sep.
I have tried ; separated before, and it works.
I took the same code and changed it a little.
I assumed that I would use acImportFixed, instead of ac ImportDelim.

I mostly used the same code for this, as for when I´m importing ; sep.
files.
But it wont work with the fixed one.

I have changed the strFile a little though

strfile = Dir("[Forms]![3ExpQFS]![FS].txt")

Is this ok?
Its not highlighted in the debugger.

I get the message
3001 'Invalid argument'

I dont really know why it wont work.
Is there something wrong with my dll-file used for importing?
I have tried making a new one 4 times, but with the same result.

The highlighted part in the debugger is

DoCmd.TransferText acImportFixed, "ImpSpecE4", "3FSSpecImp", strPath &
"\"
&
strfile

Anything wrong with this code?

Grateful for any hints or answers.

BR
/Claes
 
I don't use external schema files, but they typically are .ini files if I
recall correctly, not .dll files. And yes, I believe they need to be in a
specific folder, but I don't recall if it's the folder where the .mdb file
is located or the folder where the file being imported is located.

Try this web search link for various newsgroup postings about using schema
files:
http://groups.google.com/groups?lnk=hpsg&hl=en&q=access+import+text+ini+file+specification

I usually use stored import specifications within the .mdb file itself when
I use specifications.
--

Ken Snell
<MS ACCESS MVP>


Claes D said:
Same result anyway.

Could it be that there is something with the dll-file?
I remember reading somewhere that the dll-file or some sort of scheme has
to
be placed in the same folder as the file you are importing, when you are
importing fixed files.
Have you heard anything about that?

"Ken Snell (MVP)" skrev:
You've got doubled up \ characters when you do the TransferText. Here is
your code step:

DoCmd.TransferText acImportFixed, "ImportspecifikationExport4",
"3ExpFöljesedelSpecImportTemp", strPath & "\" & strfile

Note that you're concatenating a \ character into the string for the path
and file name. However, strPath already contains a trailing \ character,
so
this concatentation is not needed. Try this:

DoCmd.TransferText acImportFixed, "ImportspecifikationExport4",
"3ExpFöljesedelSpecImportTemp", strPath & strfile

--

Ken Snell
<MS ACCESS MVP>


Claes D said:
Actually, I only store the filename there.

I tried to change, but got the same message.

Heres most of the code.

Dim Confirm As String
Dim IntOptions As Integer
Dim bytChoice As Byte

Dim strfile As String
Dim strPath As String

strPath = "W:\Apps\Kotten\FDLLEV\"

ChDir strPath

strfile = Dir([Forms]![3ExpQFöljesedel]![Följesedel] & ".txt")

DoCmd.TransferText acImportFixed, "ImportspecifikationExport4",
"3ExpFöljesedelSpecImportTemp", strPath & "\" & strfile




"Ken Snell (MVP)" skrev:

Are you storing the path and name of the file in
[Forms]![3ExpQFS]![FS]
control? If yes, change your code step to this:

strfile = Dir([Forms]![3ExpQFS]![FS] & ".txt")


--

Ken Snell
<MS ACCESS MVP>

Hi.

I´m trying to import a fixed textfile instead of ; sep.
I have tried ; separated before, and it works.
I took the same code and changed it a little.
I assumed that I would use acImportFixed, instead of ac ImportDelim.

I mostly used the same code for this, as for when I´m importing ;
sep.
files.
But it wont work with the fixed one.

I have changed the strFile a little though

strfile = Dir("[Forms]![3ExpQFS]![FS].txt")

Is this ok?
Its not highlighted in the debugger.

I get the message
3001 'Invalid argument'

I dont really know why it wont work.
Is there something wrong with my dll-file used for importing?
I have tried making a new one 4 times, but with the same result.

The highlighted part in the debugger is

DoCmd.TransferText acImportFixed, "ImpSpecE4", "3FSSpecImp", strPath
&
"\"
&
strfile

Anything wrong with this code?

Grateful for any hints or answers.

BR
/Claes
 

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

Back
Top