Solved

Docmd.TransferText command

Posted on 1998-02-25
2
489 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
2 Comments
 
LVL 9

Accepted Solution

by:
cymbolic earned 10 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

776 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