Solved

Docmd.TransferText command

Posted on 1998-02-25
2
478 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now