Solved

Docmd.TransferText command

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

733 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