473,836 Members | 2,125 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.TransferT ext 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.TransferT ext 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 4374
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******@usato day.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
I am a pretty saavy user, but I am having a real problem with the
DoCmd.TransferT ext 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.TransferT ext 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
1964
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 staging table with 3-key PK. When duplicates are attempting import, I receive a msgbox stating the number of records that violated the PK and asks if I want to continue.
6
3058
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 newsgroup forum, so this fact was fixed. Since I have to transfer files from VMS( SAS ) to WIN (Access), I still keep using ACC97 as a simplest and reliable tool. However, final products, such as distributable data entry system for multi central...
4
9484
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 e.g. must field1, field2, filed3 etc correspond to col1, col2, col3 on the table? or can I state somewhere which columns in the text file correspond to which table columns. I actually need col1, col2, col5 and col6 from the text file to populate...
3
9434
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
1638
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 using Access 2003. The problem: When using the TransferText command in code, the first record in the text file is skipped, even with the HasFieldNames set to False.
12
2220
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 a temp table for processing using this vba code: DoCmd.TransferText acImportDelim, , "tmpPaTimeClock2", Me!TimeFileName, False When I run the import through the code, the import is dropping any values less than one (apparently). I've got a...
6
6899
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 using Transfertext, I get an error to the effect that permission is denied. The VBA line shown below - I tried using the specification DoCmd.TransferText acExportDelim, "QryOracleView Export Specification", "qryOracleView", strSaveFile, -1
0
2035
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 file below in WordPad and call the file "HeaderYES.txt" (the space between the two fields is actually a tab):- "Column1" "Column2" 1 "Line1"
5
3512
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 correctly and in order. When I use the TransferText macro, and specify all the same paramenters i.e. fixed width, import specification, file path, table name etc, the data is imported; however, it is 'jumbled.' It is not in the same order as the text...
0
9812
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9657
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10532
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10577
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10243
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6975
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5812
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4443
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 we have to send another system

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.