473,416 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

TransferText and First Record in Text file

I am using this command to import text file:

DoCmd.TransferText acImportDelim, str_SpecName, str_TblName,
str_FileName, False

- The import will always be missing the first line in the text file.
- These text files are coming out of Access.
- The first line is formatted exactly the same and end with the same
CR/LF that the rest of the file has.

The text files I am importing with this problem will have either 125 or
143 fields, CSV, all fields enclosed in double quotes, even empty
fields.

If I use this same command, but the text fields and spec are for fewer
fields, 37 or 40, then the first line imports fine.

Any ideas or pointers?

Daron

Dec 2 '05 #1
3 2522
Daron" <Da**********@gmail.com> wrote
I am using this command to import text file:

DoCmd.TransferText acImportDelim, str_SpecName,
str_TblName, str_FileName, False

- The import will always be missing the first line in the text file.
Two things to consider:

(1) try omitting the False for the "HasFieldNames" argument, and let it
default to False -- shouldn't make any difference, but stranger things have
happened.
(2) could it be that the length of the text in that first record exceeds
the number of characters allowed in an Access record?

The second item comes to mind as a possible problem when you say
If I use this same command, but the text fields and spec
are for fewer fields, 37 or 40, then the first line imports fine. - These text files are coming out of Access.


A third thing to consider -- don't use the intermediary of a delimited text
file. Either link directly to the tables in the other Access database, or
export as a database file (maybe a dBase, .DBF).

This isn't a feature that I often use, but these are just "general
suggestions".

Have you considered using File I/O instead of TransferText -- Import? That
puts the operation under your control... a bit more effort, but sometimes it
is "comforting" to be "in command".

Larry Linson
Microsoft Access MVP
Dec 2 '05 #2
I have thought about the file i/o option, just trying to do the simple
option first, as the files could have 37, 40, 125, or 140 fields, that
then need to be 'standardized' to 40 fileds. I will try the the other
options first. Let you know Monday after I get back to work!

Just a thought, but would reading each line into a variable, and then
using the split() command work for this?

Thanks for your suggestions!

Dec 3 '05 #3
I often use the Line Input command. I used various coded implementations of
a split before Access had the command. Since Access has had that command,
Split has worked nicely for me.

Larry Linson
Microsoft Access MVP

"Daron" <Da**********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
I have thought about the file i/o option, just trying to do the simple
option first, as the files could have 37, 40, 125, or 140 fields, that
then need to be 'standardized' to 40 fileds. I will try the the other
options first. Let you know Monday after I get back to work!

Just a thought, but would reading each line into a variable, and then
using the split() command work for this?

Thanks for your suggestions!

Dec 3 '05 #4

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

Similar topics

6
by: Ruben | last post by:
Hello. I am trying to read a small text file using the readline statement. I can only read the first 2 records from the file. It stops at the blank lines or at lines with only spaces. I have a...
12
by: alessia | last post by:
hi, I have a query that visualizes me, according to some criterions from me inserted, name , Surname , Address , phone ok.. Now, through a button, positioned in a Form, I have to only export...
16
by: Michael | last post by:
I have a data application in a2k that I need to create two fixed width text files and then combine them to a single file The first file is header information and the second is transaction data. ...
2
by: Bob Whisnant | last post by:
In Access 2000, I'm using the DoCmd.TransferText to import a tab delimited .txt file into my database. I'm using a specification file to set field names and data type. The HasFieldNames argument is...
2
by: N. Graves | last post by:
I'm planning to develop a process to import data from an external flat file to a new table automatically. As usual I'm having a hard time getting started on the solution because of the Access's...
4
by: Jay | last post by:
This is a strange one that I can't seem to find a fix for. We have a Billing DB application (Access 2000 format) where we upload billing info in a comma delimited text file to our printer who...
3
by: holdemfoldem | last post by:
Hi. I'm new to this board and have a few questions about using the method referred to in the topic of this message. I have manually transferred over 1/2 million records from a text file into my...
2
by: Steve Cartnal | last post by:
I need to copy records from several different tables into one text file. Although the tables have many common fields, they also contain several that are different from table to table. I can copy...
3
by: Wayne | last post by:
I'm trying to automate the export of a query to a text file using code. If I export the query manually I get the exact result that I want i.e. If I select the query then choose File/Export from...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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
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...
0
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,...

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.