Adding Records to an Access Table

Posted on 2014-08-28
Last Modified: 2014-09-03
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
Question by:GenieMaster
    LVL 39

    Accepted Solution

    Try this sample
    LVL 39

    Expert Comment

    Try this sample

    Author Closing Comment

    Dear ASL315,
    Thanks. What you did was perfect and just what I needed. Could not ask for any better. Brilliant. :)

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    In the previous article, Using a Critera Form to Filter Records (, the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
    In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now