Import & Delete Rows

G

Guest

I need some help with two problems.

First let me start out by saying I am new to MS Access.

1. I'm importing a text file into my access db however the text file has the
following rows that I do not want imported

The First 4 rows

Source File Name : CDW - Facility
File Create Date : 20060209
Time Period : 200512
SRC_SYS_ID|CORP_NBR|IP_ID|OBLIGOR_NUM|

And the last 3 rows

Total Number of records - 50516
Total Facility Limit - 82529811024.27
Total Charge Off - 638805636.63

This is the SQL command I am useing to import the data

DoCmd.TransferText , "EC_Facility_Specification v4 (type)", "(1) ec_facility
- New", varFilename, True

DoCmd.RunSQL "SELECT [obligor_num] & ['_'] & [obligation_num] AS
[obligor & obligation], [(1) ec_facility - new].* INTO Current_Month_Data
FROM [(1) ec_facility - new]"

Can you help so when I import the text file those rows will be deleted
 
R

RD

It looks like you already have an Import Specification set up. You can specify
which fields to import and which to skip in the Import Spec.

Hope that helps,
RD
 
J

John Nurick

Hi Chris,

It's not possible to delete rows from a text file while importing. The
simplest thing, if possible, is probably to add a WHERE clause to your
append query that will exclude the rows you don't want, or include only
those that do.

Otherwise, the best approach is probably to delete these lines from the
text file before importing. There's a link on this page
http://www.j.nurick.dial.pipex.com/Code/index.htm to a function that
deletes a given number of lines from beginning and/or end of a text
file.




I need some help with two problems.

First let me start out by saying I am new to MS Access.

1. I'm importing a text file into my access db however the text file has the
following rows that I do not want imported

The First 4 rows

Source File Name : CDW - Facility
File Create Date : 20060209
Time Period : 200512
SRC_SYS_ID|CORP_NBR|IP_ID|OBLIGOR_NUM|

And the last 3 rows

Total Number of records - 50516
Total Facility Limit - 82529811024.27
Total Charge Off - 638805636.63

This is the SQL command I am useing to import the data

DoCmd.TransferText , "EC_Facility_Specification v4 (type)", "(1) ec_facility
- New", varFilename, True

DoCmd.RunSQL "SELECT [obligor_num] & ['_'] & [obligation_num] AS
[obligor & obligation], [(1) ec_facility - new].* INTO Current_Month_Data
FROM [(1) ec_facility - new]"

Can you help so when I import the text file those rows will be deleted
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top