473,503 Members | 5,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TransferText doesn't work like Menu Import

I am a pretty saavy user, but I am having a real problem with the
DoCmd.TransferText operation.
I manually used the File>Get External Data> Import routine to set up an
import specification. It works like a champ everytime it's run.

If I use VBA to execute a TransferText and specify the specfile, I get
a Type Conversion Error on import and a table full of empty records
(equal to the number of lines in my import data file).

My data source file is a fixed-length text file.

Here is my VBA line:

DoCmd.TransferText acImportDelim, "MySpec", "tblTemp", "C:\MyData",
False

I have tried a lot to get this to work.

I first let Access import it into a new table that it created. Then I
opened it up and copied down the data types. I then specified the same
data types in my import table (tblTemp).

The data file has 10 fields. The first and seventh fields are vbLong
types, the others are vbText types.

It's always erroring out on the first field.

Again, it always works fine when manually launched through the menus.

Any suggestions? I'm stuck until I find a solution. Thanks in advance.

Nov 13 '05 #1
3 4349
One observation is that you say the file is fixed length yet you are using
the acImportDelim parameter rather than the acImportFixed.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"Typehigh" <nm******@usatoday.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I am a pretty saavy user, but I am having a real problem with the
DoCmd.TransferText operation.
I manually used the File>Get External Data> Import routine to set up an
import specification. It works like a champ everytime it's run.

If I use VBA to execute a TransferText and specify the specfile, I get
a Type Conversion Error on import and a table full of empty records
(equal to the number of lines in my import data file).

My data source file is a fixed-length text file.

Here is my VBA line:

DoCmd.TransferText acImportDelim, "MySpec", "tblTemp", "C:\MyData",
False

I have tried a lot to get this to work.

I first let Access import it into a new table that it created. Then I
opened it up and copied down the data types. I then specified the same
data types in my import table (tblTemp).

The data file has 10 fields. The first and seventh fields are vbLong
types, the others are vbText types.

It's always erroring out on the first field.

Again, it always works fine when manually launched through the menus.

Any suggestions? I'm stuck until I find a solution. Thanks in advance.
Nov 13 '05 #2
The type conversion error indicates that the fields are not exactly as
you think they are... normally.

The fact that the import works manually with the MySpec specification
should mean that it should work with the acImportDelim...

However, you might have come across the same problem that i did, in
that the end-of-line characters can appear to be fine but when you try
to do anything in VB, you just get errors.

You might find that there are spurious characters in the input file.

Try a hex file reader and walk through the characters in the file to be
sure there is nothing wierd in there then post back what you find and
we'll all go from there.

Rob.

Nov 13 '05 #3
David your observation was right on the money. I changed the Transfer
Type from acImportDelim to acImportFixed and it worked perfectly.
Thanks for such a quick reply, I would have never discovered my
oversight.

Thanks again,

Neil (Typehigh)

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1937
by: ms | last post by:
In Access 2000, I am using... 'Import Raw text to stageBMIDLog table. DoCmd.TransferText acImportFixed, "BMIDLog Link Specification", "stageBMIDLog", file ....to import raw records into a...
6
3002
by: Vladislav Moltchanov | last post by:
I have discovered a couple of years ago, that import with DoCMD.TransferText for CSV text file doesn’t work in Acc2000, while it works perfectly in ACC97. which has been discussed on this...
4
9457
by: khutch | last post by:
Not that up on MS Access. I understand that the TransferText command can be used to import csv files into a database. Question: Does the text file have to mirror the alignment of the table columns...
3
9371
by: Oliver Gabriel | last post by:
Hi, i want to export a table for later import, using vba. That´s my code: export: filename = "C:\HVOtabelle.txt"
0
1600
by: Daron | last post by:
I am posting this as I have not been able to find a direct posting with a specific solution, just work arounds (usually the need to create custom import routines.) I found the solution! I am...
12
2165
by: ckirby | last post by:
I've got a csv that I am trying to import into a SQL Server (2000) table through an adp (Access 2000). The form used gives the user the ability to browse for a file, then will import the file into...
6
6873
by: Tim Marshall | last post by:
IN trying to export a Jet query (an actual saved Jet querydef which is written against a pass through query - not that that should be a problem) to text via either the File->Export... menu item or...
0
2003
by: Sean Howard | last post by:
I have a strange problem linking tab delimited text files in Access 2000 (I am running Windows XP), please try this and let me know if I am going mad. Step 1. Create the tab-delimited text...
5
3485
by: bwlee | last post by:
Hi All, I'm attempting to automate the import of .txt files into Access. When I use the File > Get External Data > Import function and select my import specification, the data is imported...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6976
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.