473,385 Members | 1,925 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,385 software developers and data experts.

Ms Access 2003 - Text File is imported out of sequence

Hi All

On importing a text file using the TransferText method into an empty, existing table in an Access 2003 database I occasionally find that although the data has all imported ok it is not in the sequence of the original text file. The existing table into which the table is imported is just a range of text fields, F1 through F17 with no primary key field and the text file is comma delimited.

The problem was encountered during testing where the same text file was used. The puzzling thing is that the problem is intermittent only, more often than not the import works fine, just occasionally importing out of sequence.

Has anyone else encountered this problem and know of a solution?

Best Regards
Chris
Aug 12 '07 #1
7 2638
puppydogbuddy
1,923 Expert 1GB
Hi All

On importing a text file using the TransferText method into an empty, existing table in an Access 2003 database I occasionally find that although the data has all imported ok it is not in the sequence of the original text file. The existing table into which the table is imported is just a range of text fields, F1 through F17 with no primary key field and the text file is comma delimited.

The problem was encountered during testing where the same text file was used. The puzzling thing is that the problem is intermittent only, more often than not the import works fine, just occasionally importing out of sequence.

Has anyone else encountered this problem and know of a solution?

Best Regards
Chris
Just a guess. Some of your text fields get padded with a space or spaces on the left. Try using the trim function to remove leading or trailing spaces.
Aug 12 '07 #2
Just a guess. Some of your text fields get padded with a space or spaces on the left. Try using the trim function to remove leading or trailing spaces.
Yep, I guess they could screw things up but wouldn't they screw it up consistently whereas the problem i am encountering only happens occasionally. I'll give it a go though. Many thanks.
Aug 12 '07 #3
puppydogbuddy
1,923 Expert 1GB
Yep, I guess they could screw things up but wouldn't they screw it up consistently whereas the problem i am encountering only happens occasionally. I'll give it a go though. Many thanks.

If the source file for the transfer text is created by data entry, it could boil down to a person or person(s) accidentally hitting the space bar by mistake on an intermittent basis while doing the input.
Aug 13 '07 #4
Sorry, I didn't explain it well. The source file that is being imported was a test file and it was the same source file used each time. Most times it worked ok, just occasionally giving me the out of sequence problem.

Cheers
Chris
Aug 14 '07 #5
puppydogbuddy
1,923 Expert 1GB
Sorry, I didn't explain it well. The source file that is being imported was a test file and it was the same source file used each time. Most times it worked ok, just occasionally giving me the out of sequence problem.

Cheers
Chris
I need more info.
1. Are you using an import specification? If not, that might eliminate the problem.
2. Describe the contents of the text file.
3. Comma delimited or space delimited?
4. Post your DoCmd.transfertext syntax.
Aug 14 '07 #6
Hi

1. I am not using an import spec because access default if fine.
2. Example of text file below. Note that the first line is always a header (HDR) line.

HDR, 02/08/2007, 10:26:10, VAESVMDMREA2625.H02
I,"REA","0000080963TR-122","","E","","","","","","","","","","02/08/2007 00:00:00","","1"
M,"07A63722:1","40849755","10.57800000","T","","", ""
I,"REA","0000080970TR-74F","","E","","","","","","","","","","02/08/2007 00:00:00","","1"
M,"07A61701:1","40847734","1190.35000000","T",""," ",""

3. Comma delimited
4. DoCmd.TransferText acImportDelim, , "sch", "c:\read files\sch\sch.txt", False

I suppose the interesting thing about this issue is that it is intermittent. Using exactly the same text file it works fine most of the time, just occasionally importing out of sequence.

Regards
Aug 14 '07 #7
puppydogbuddy
1,923 Expert 1GB
Hi

1. I am not using an import spec because access default if fine.
2. Example of text file below. Note that the first line is always a header (HDR) line.

HDR, 02/08/2007, 10:26:10, VAESVMDMREA2625.H02
I,"REA","0000080963TR-122","","E","","","","","","","","","","02/08/2007 00:00:00","","1"
M,"07A63722:1","40849755","10.57800000","T","","", ""
I,"REA","0000080970TR-74F","","E","","","","","","","","","","02/08/2007 00:00:00","","1"
M,"07A61701:1","40847734","1190.35000000","T",""," ",""

3. Comma delimited
4. DoCmd.TransferText acImportDelim, , "sch", "c:\read files\sch\sch.txt", False

I suppose the interesting thing about this issue is that it is intermittent. Using exactly the same text file it works fine most of the time, just occasionally importing out of sequence.

Regards
Your problem is probably due to the header line. If you get rid of that header line manually, or through an Import Spec, I think your problem will be resolved. In the syntax of your transferText, you've set hasfields = false....this tells Access that the first row is normal data, not a header or column name (see excerpt from Access Help below) . My theory is that most of the time Access recognizes that the header is not a data row in spite of the syntax, and probably ignores it, but not always (hence..intermittent problems).
__________________________________________________ _____________
hasfieldnames Use True (–1) to use the first row of the text file as field names when importing, exporting, or linking. Use False (0) to treat the first row of the text file as normal data. If you leave this argument blank, the default (False) is assumed.
Aug 14 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Zachariah | last post by:
Part of a Windows Service app I created in .NET 2003 has the following code: Dim stOutPath As String Dim stTableName As String Const strDBPath As String = "C:\test_be.mdb" acApp = New...
1
by: mark | last post by:
In Access 2000 and 2002, I have created an import specification to import the fixed-width recordset below into an existing table. I am having strange problems with the import of the date and time...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
1
by: musicloverlch | last post by:
What's up with the text import wizard in Access 2003? We have a large text file that needs to be imported. Tried it on Access 2003 and it just sits there with an hourglass. Tried it on Access 97...
52
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server...
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
2
by: Quique | last post by:
Hello, I've got a problem importing a worksheet Excel into a temporary table in access. All the information is imported but the table is not ordered as it is originally in excel. I'm using a...
1
by: Capn Stoobie | last post by:
I have a database that I regularly import data into from a text file. The text file is produced by payroll software, and it is always the same format. Most of the time my acImportDelim command...
5
by: lgeastwood | last post by:
I have a weird problem in Access 2007. I've been working in A07 for about 2 weeks when this thing began occurring. I'm working in the VB Code Editor and set break points for event procedures....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.