user3051587
user3051587

Reputation: 1

MS ACCESS QUERY AUTONUMBER GENERATION

My MS Access database table is linked with some excel files. Those excel files have same fields and each file has around 2000 records. I created a Union query (qryUnion) and clubbed all into one database. Now I need to pick a few samples out of these data. I have the sample record numbers in another table (tblSample). If the qryUnion query table has the serial numbers, then it is possible to create the database based on tblSample. The qryUnion table doesn't have any record number or serial number and it consists of non-unique data. Is there any way to do this?

e.g.

qryUnion table

    Field1     Field2      Field3
    x1          234         455
    x2          44          88
    x2          59          24
    x5          33          54
    x1          400         4
    m2          44          094
    x4          444          4

tblSample table

    Field1
    2
    5 
    7

I want a query table like..

    Field1      Field2      Field3      Field4
    x2          44          88           2
    Y1          400         4            5
    x4          444         4           7

Upvotes: 0

Views: 1628

Answers (1)

Brendan
Brendan

Reputation: 1247

If you add a new field to all your Excel sheets that has a row indicator, you can then have a unique value in your qryUnion made up of Excel File + Row. In your sample query you would just need to reference Excel Name + Row (if you are able to do so)

You will only be able to crate the Auto Number field in an actual table in MS Access meaning that you need to import the data instead of linking it.

Upvotes: 1

Related Questions