Extracting range of data in a table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

One more issue I need resolved with my database.

I import a text file into a table; however, I need to extract only a portion
of the data.
I cannot run a query because the imported text file is actually a report
that is split into three sections. I need the second section so I'm
searching for particular text.
The sections are confirmed fraud, unconfirmed and no fraud. I need to write
some logic to find the unconfirmed text and select the rows through to the no
fraud section. There is only one occurrence of the text for each section.

Any suggestion?
 
Why do you say that you cannot run a query? A query is the ONLY method
available for selecting data from a table. To select the "second section"
you need to include criteria in your query that identifies the rows you are
looking for.
 
How would I write the query? There is no other information that I can use to
exclude the confirmed fraud and no fraud sections. The words "confirmed
fraud" and "no fraud" only appear once in the table because I imported the
report (they are sections of a report). I have visual basic logic in Excel
that sets the range to extract the Unconfirmed and paste it into a new
spreadsheet. However, I want to perform the same or a similar function
within Access so I don't need to use both Excel and Access.
 
How about using VBA code to make a pass over the data after importing it,
delete everything before the middle section, keep everything after that until
you get to the last section, then delete everything after that.

alternatively, if a key is being assigned as the data is imported, use a
query to look up the records with the section headers in it, then delete
everything less than the 2nd section header and greater than the third
section header key.

Enjoy, j.
 
Relational databases are not spreadsheets. They work very differently.
There is no concept of row number or range. Those are "flat" file concepts.
With a relational database you use queries with selection criteria to select
sets of data. That means that your table must include a column with data
that will allow you to select what you want.

Jen suggested a VBA process. Another possibility is to write a macro in
Excel that assigns each row to a group BEFORE you import the data. That
will allow you to run queries once the data is loaded.
 

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

Back
Top