Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 98
  • Last Modified:

Adding Records to an Access Table

I want to run a query that on click will look at a file and add records based on the values in that file.
I have a file called example.txt  

the values of the file are like this


The database is called productlabels. The table is called mlabels.
In this table is the columns
Id (this is an auto number)
pi (this is a text value column)
col_id (this is a text value column)
col_description (this is a text value column)

I want the query to read and add the value "463" to column 2 (pi) "BEI" to column 3  (col_id) "BEIGE" to column 4 (col_description) as the last value was 10 I want it to create 10 records of this value. Then it should do the same for the next line but that has 15 records as you can see in the file and likewise for how many entries are listed in the text file.
In completion of the query if the file name can be renamed to example_done.txt
This is to avoid if the action query is run again it will not create a duplicate of those already added.

I am hoping that the query on running would the table be like this;

1  463 BEI BEIGE
2  463 BEI BEIGE
3  463 BEI BEIGE
4  463 BEI BEIGE
5  463 BEI BEIGE
6  463 BEI BEIGE
7  463 BEI BEIGE
8  463 BEI BEIGE
9  463 BEI BEIGE
10  463 BEI BEIGE
11 454 BLK Black
12 454 BLK Black
13 454 BLK Black
14 454 BLK Black
15 454 BLK Black
16 454 BLK Black
17 454 BLK Black
18 454 BLK Black
19 454 BLK Black
20 454 BLK Black
21 454 BLK Black
22 454 BLK Black
23 454 BLK Black
20 454 BLK Black
21 454 BLK Black
22 454 BLK Black
23 454 BLK Black
24 454 BLK Black
25 454 BLK Black
  • 2
1 Solution
Try this sample
Try this sample
GenieMasterAuthor Commented:
Dear ASL315,
Thanks. What you did was perfect and just what I needed. Could not ask for any better. Brilliant. :)

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now