Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Importing / Linking / June 2007

Tip: Looking for answers? Try searching our database.

Need a way to have my import routine filter out bad records.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dbguy11 - 07 Jun 2007 19:39 GMT
I have simple import routine that pulls any txt file from a selected folder
and uses an import spec I created puts the txt file into a table I created in
Access. What is the best way to filter out bad records during the import.
Right now I use a delete query and just delete any record with a null value
in the Unit Price field. There is also a Type Code field that is always 207
if it is a good record and I could filter it that way. Below is the import
routine I use, if you have any suggestions on how to change to filter the bad
records I would appreciate it very much. Thanks in advance for any assistance
you can provide me.

Function btnImportAll()
Dim strfile As String

ChDir ("c:\PX06")
strfile = Dir("*.*")
Do While Len(strfile) > 0
DoCmd.TransferText acImportDelim, "PX06", _
"PX06", "c:\PX06\" & strfile, True
Kill "c:\PX06\" & strfile
strfile = Dir
Loop

End Function
Klatuu - 08 Jun 2007 13:42 GMT
Rather than identifying the destination as the table, use an append query
that will filter the records during the import.
Signature

Dave Hargis, Microsoft Access MVP

> I have simple import routine that pulls any txt file from a selected folder
> and uses an import spec I created puts the txt file into a table I created in
[quoted text clipped - 19 lines]
>
> End Function
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.