ClimoC
Well-known Member
- Joined
- Aug 21, 2009
- Messages
- 584
Probably not exactly what you thought when seeing the thread title...
I already evaluate a whole bunch of stuff from collections etc. Then I get to do the update query.
Thing is, that I have to set 'Status' to be either 'not required' or 'complete' depending on whether it was assigned in the first place or not. All the googling I can muster has only pointed me to slipping IIF statements in to retrieve column names or update values. I need it to change the value of the status, depending on the value found in a field (not currently in the 'WHERE' parameter)
...Um... How?
The extra field is 'assigned'.
So in written english: (sorta)
If the record at [ID] = (collection item), [assigned] = "awaiting assignment", [archive] value is 0, THEN: set [status] to "not required", updated to today (as an int, eg 41524), and [archive] to -1
OTHERWISE...
If the record at [ID] = (collection item), [assigned] = "assigned", [archive] value is 0, THEN: set [status] to "complete", updated to today (as an in, eg 41524), and [archive] to -1
Basically, I don't want to have to write 2 SQL statements and execute them both - because this runs in a loop across 2-3000 records once a day.
Is it a PROCEDURE I'm after? If so, do I have to code that into the Accdb itself as a public function or something? Never done Procedures....
Thanks
C
I already evaluate a whole bunch of stuff from collections etc. Then I get to do the update query.
Code:
strsql = "UPDATE [work] SET status = 'not required', updated = " & clng(int(now())) & ", archive = -1 WHERE ID = " & SAT.Item(iKey) & " AND archive = 0"
cnImportConn.Execute (strsql)
Thing is, that I have to set 'Status' to be either 'not required' or 'complete' depending on whether it was assigned in the first place or not. All the googling I can muster has only pointed me to slipping IIF statements in to retrieve column names or update values. I need it to change the value of the status, depending on the value found in a field (not currently in the 'WHERE' parameter)
...Um... How?
The extra field is 'assigned'.
So in written english: (sorta)
If the record at [ID] = (collection item), [assigned] = "awaiting assignment", [archive] value is 0, THEN: set [status] to "not required", updated to today (as an int, eg 41524), and [archive] to -1
OTHERWISE...
If the record at [ID] = (collection item), [assigned] = "assigned", [archive] value is 0, THEN: set [status] to "complete", updated to today (as an in, eg 41524), and [archive] to -1
Basically, I don't want to have to write 2 SQL statements and execute them both - because this runs in a loop across 2-3000 records once a day.
Is it a PROCEDURE I'm after? If so, do I have to code that into the Accdb itself as a public function or something? Never done Procedures....
Thanks
C
Last edited: