J
Jesse
Using Access 2000, I am trying to find a good way to sort a secondary
column in a table before an autonumber is assigned for each record.
We have a db into which we regularly import two data files -- a
transaction file and a details file, related via a trans_id.
These two files are already sorted (ascending) by trans_id and the
details file is _currently_ imported/appended into a table with an
extra column that is set to autonumber.
The details file has a group_id column. After each import, we would
like to have that column sorted (ascending, secondary to trans_id)
_before_ the autonumbers are generated for the newly imported rows.
Among the solutions I've considered, my current choice:
1. Create tbl_details_1 with all of the columns that are in the
details file (but without an autonumber column).
2. Create tbl_details_procsd also with all of the columns that are in
the details file + an autonumber column at the end. Create a unique
index in this table that combines trans_id and group_id (to block
duplicate records from being added).
3. Import the details file into tbl_details_1.
4. Create a "find unmatched" query -- q_sort_appnd -- for
tbl_details_1 and tbl_details_procsd that sorts on trans_id and
group_id and that appends the resulting records to tbl_details_procsd
-- where autonumbers are then generated for the appended records.
Assuming this would work, is there a more straightforward way to do
it?
Noting that I am a newbie at direct coding, modules, and such... is
there a straightforward way to get q_sort_appnd to run automatically
after every import into tbl_details_1?
(Because the details file has a different name every time (it does
have the same last 6 characters, though: "-2.txt") we have been using
the manual process for selecting and importing the file every time.
We'll solve that problem when we figure out how to write code that
says, "Look in a specified folder, select the most recent file that
ends in '-2.txt', and then import that using this import spec.)
Thanks. -- Jesse
5. , and then append it
In the details file there is a group_id column, and any single
trans_id there can be multiple group_id values. Because of the way
that the details file is generated, the group_id records for a given
trans_id can be in
some , There is one column in the details file that we would like to
have sorted before the autonumber is assigned
column in a table before an autonumber is assigned for each record.
We have a db into which we regularly import two data files -- a
transaction file and a details file, related via a trans_id.
These two files are already sorted (ascending) by trans_id and the
details file is _currently_ imported/appended into a table with an
extra column that is set to autonumber.
The details file has a group_id column. After each import, we would
like to have that column sorted (ascending, secondary to trans_id)
_before_ the autonumbers are generated for the newly imported rows.
Among the solutions I've considered, my current choice:
1. Create tbl_details_1 with all of the columns that are in the
details file (but without an autonumber column).
2. Create tbl_details_procsd also with all of the columns that are in
the details file + an autonumber column at the end. Create a unique
index in this table that combines trans_id and group_id (to block
duplicate records from being added).
3. Import the details file into tbl_details_1.
4. Create a "find unmatched" query -- q_sort_appnd -- for
tbl_details_1 and tbl_details_procsd that sorts on trans_id and
group_id and that appends the resulting records to tbl_details_procsd
-- where autonumbers are then generated for the appended records.
Assuming this would work, is there a more straightforward way to do
it?
Noting that I am a newbie at direct coding, modules, and such... is
there a straightforward way to get q_sort_appnd to run automatically
after every import into tbl_details_1?
(Because the details file has a different name every time (it does
have the same last 6 characters, though: "-2.txt") we have been using
the manual process for selecting and importing the file every time.
We'll solve that problem when we figure out how to write code that
says, "Look in a specified folder, select the most recent file that
ends in '-2.txt', and then import that using this import spec.)
Thanks. -- Jesse
5. , and then append it
In the details file there is a group_id column, and any single
trans_id there can be multiple group_id values. Because of the way
that the details file is generated, the group_id records for a given
trans_id can be in
some , There is one column in the details file that we would like to
have sorted before the autonumber is assigned