troubleshooting Question

Adding Records to an Access Table

Avatar of GenieMaster
GenieMaster asked on
Microsoft Access
3 Comments1 Solution111 ViewsLast Modified:
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

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros