the_net_2.0
Banned
- Local time
- Today, 01:33
- Joined
- Sep 6, 2010
- Messages
- 812
All,
I am working in VB6 and I'm running an update query with an "IN" subquery. The update query is updating one field in records that have ID's that are in the temp table. so the query looks like:
After this, I need to append this same record information to a log table. The INSERT INTO statement will be using a combination of variable values and actual field names from the table. It will look like this:
The log table has an ID field in it and each record has to be incremented by one. I don't have the authority to change it to an autonumber, so I'm looking for a way to run a query (or 2?) that will append the records from my 'TABLE' but at the same time incrementing the ID field by one for each of the records appended.
I'm assuming that this can't be done in a batch append process, correct? This is vb6 and I'm trying to think of a method here that will avoid me having to loop recordsets and perform and "addnew" on the Log Table, one record at a time from my temp table.
Thanks for any help guys. Appreciate it.
I am working in VB6 and I'm running an update query with an "IN" subquery. The update query is updating one field in records that have ID's that are in the temp table. so the query looks like:
Code:
UPDATE TABLE SET TABLE.FIELD = TABLE.FIELD - 128 WHERE
(((TABLE.FIELD >= 128 AND TABLE.Ref) In
(SELECT TABLE-temp.ID FROM TABLE-temp)));
After this, I need to append this same record information to a log table. The INSERT INTO statement will be using a combination of variable values and actual field names from the table. It will look like this:
Code:
INSERT INTO LOGTABLE (1, 2, 3, 4)
SELECT "value", "value", TABLE.FIELD1, TABLE.FIELD2
FROM TABLE
The log table has an ID field in it and each record has to be incremented by one. I don't have the authority to change it to an autonumber, so I'm looking for a way to run a query (or 2?) that will append the records from my 'TABLE' but at the same time incrementing the ID field by one for each of the records appended.
I'm assuming that this can't be done in a batch append process, correct? This is vb6 and I'm trying to think of a method here that will avoid me having to loop recordsets and perform and "addnew" on the Log Table, one record at a time from my temp table.
Thanks for any help guys. Appreciate it.