G
Guest
Hi all,
Against all odds, I have another question. I need to go through the DB
after reading in a file and update one field in each record for the whole
table. And I have no idea how to do it.
Once I've read the file, I need to sort it by Part_Num, Serial_Num,
Store_Num, Date, Time (all are fields). Then I need to add to the Delivery
field based on the number of deliveries.
ie. There will be repeating Part_Num, Serial_Num, Store_Num, but varying
Date and Time. The earliest delivery gets a Delivery value of 1. The latest
delivery gets a value indicating the total number of deliveries. So if there
were 5 deliveries, the latest record will have a Delivery value of 5.
And then it repeats from 1 to whatever for the next Part, Serial, Store. I
need to perform this check EACH time a file is inserted into DB. And there
may be older files added, so I have to perform the check for every record
everytime. So if there is a value in delivery already, I can't assume the
value will remain the same.
I hope that explaination makes sense...
So I'm not sure if I need to create a query that would order the table as I
need it. And if so, I don't know how to do that programmatically. I can
create a query using CreateQueryDef, but once created, I can't find an
example of going through the results of that query and updating a field of
each record.
Might a DoCmd.RunSQL be more appropriate?
Again, any help is appreciated. Or maybe a relevant link?
Thanks,
Jay
Against all odds, I have another question. I need to go through the DB
after reading in a file and update one field in each record for the whole
table. And I have no idea how to do it.
Once I've read the file, I need to sort it by Part_Num, Serial_Num,
Store_Num, Date, Time (all are fields). Then I need to add to the Delivery
field based on the number of deliveries.
ie. There will be repeating Part_Num, Serial_Num, Store_Num, but varying
Date and Time. The earliest delivery gets a Delivery value of 1. The latest
delivery gets a value indicating the total number of deliveries. So if there
were 5 deliveries, the latest record will have a Delivery value of 5.
And then it repeats from 1 to whatever for the next Part, Serial, Store. I
need to perform this check EACH time a file is inserted into DB. And there
may be older files added, so I have to perform the check for every record
everytime. So if there is a value in delivery already, I can't assume the
value will remain the same.
I hope that explaination makes sense...
So I'm not sure if I need to create a query that would order the table as I
need it. And if so, I don't know how to do that programmatically. I can
create a query using CreateQueryDef, but once created, I can't find an
example of going through the results of that query and updating a field of
each record.
Might a DoCmd.RunSQL be more appropriate?
Again, any help is appreciated. Or maybe a relevant link?
Thanks,
Jay