?
Solved

Docmd.TransferText command

Posted on 1998-02-25
2
Medium Priority
?
501 Views
Last Modified: 2010-05-18
Hi

i have a text file that i need to import to an existing table. i have created the import specifications and everything works fine. however, sometimes the text file has a corrupted record and the docmd.TransferText reports an error. in particular, i got error 3349 - numeric field overflow.

i just need to know if there is a way to extract the bad record and stilll complete the rest of the import process?

Keith
0
Comment
Question by:keithcsl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
cymbolic earned 40 total points
ID: 1969203
Couple of things you can do Keith, but you may not like either one.  I have automated a number of these text imports throuh Access for migration purposes. Many of the errors you get will allow you to continue, but error records will be indicated in a generated errors table.  Some fields don't make the trip, and some records may not make the trip.

What I have done is to write some simple basic file conversion/field editors to preprocess my input text files to avoid these problems. You are right, your biggest problem comes from garbaged input.  

Another possibility you might consider is to change the datatype of the column that gives you a numeric overflow, to a larger number type.  You can always modify the datatype of a column after the import is complete, but you will still loose some numeric values that overflow, when you convert from say a long to an integer, etc.

Since I do these repeatedly, I also examine the database for leftover import errors tables before each run, and delete all that show up thusly:
Dim dbs As Database, x$, y$, baldt$
 Dim tdf As TableDef, i As Integer
 Set dbs = CurrentDb
' Set dbs = OpenDatabase(x$ + "COMMON.MDB")
Application.Echo True, "Cleaning Out Database"
DoEvents
 With dbs
  For Each tdf In .TableDefs
   If InStr(tdf.Name, "_ImportErrors") > 0 Then
    x$ = "Drop Table " & tdf.Name
    dbs.Execute x$
   ElseIf InStr(tdf.Name, "MSys") = 0 And InStr(tdf.Name, "XOrg") = 0 Then
    x$ = "Delete * from " + tdf.Name
    dbs.Execute x$
   End If
  Next tdf
 End With

Note the above also empties out all tables as well, except for system tables and one table I save for cross reference lookup purposes  
0
 
LVL 1

Author Comment

by:keithcsl
ID: 1969204
auuughhh.... sounds like hard work huh? but i guess it will have to be done somehow.

i am working on an alternative way of solving this problem, maybe importing line by line and fish out the bad records. i am investigating on the speed of this approach.

i like ur idea of clening out the redundant tables. i am sure it will be useful.

Keith

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question