Performing more than one query in an Access SQL Query?

Can it be done?

For example, I need to run the following update query:

"UPDATE ComputerLeases_Transactions SET ComputerLeases_Transactions.Payment9Date = Date()
WHERE (([Payment8Date] Is Not Null And [Payment9Date] Is Null))"

But I need to do it 9 different times. For example:

"UPDATE ComputerLeases_Transactions SET ComputerLeases_Transactions.Payment9Date = Date()
WHERE (([Payment8Date] Is Not Null And [Payment9Date] Is Null))
UPDATE ComputerLeases_Transactions SET ComputerLeases_Transactions.Payment8Date = Date()
WHERE (([Payment7Date] Is Not Null And [Payment8Date] Is Null))
... etc..."

Is there a way to do this in Access or do I have to create 9 different Update queries to accomplish 9 simple operations?

Thanks in advance for any help.
-Cube
[833 byte] By [cube01] at [2007-11-19 19:31:46]
# 1 Re: Performing more than one query in an Access SQL Query?
Can it be done?
Maybe:

UPDATE ComputerLeases_Transactions
SET
ComputerLeases_Transactions.Payment9Date = IIF((([Payment8Date] Is Not Null And [Payment9Date] Is Null)),Date(),[Payment9Date] )
,ComputerLeases_Transactions.Payment8Date = IIF((([Payment7Date] Is Not Null And [Payment8Date] Is Null)),Date(),[Payment8Date] )
... etc...
WHERE
(([Payment8Date] Is Not Null And [Payment9Date] Is Null))
OR
(([Payment7Date] Is Not Null And [Payment8Date] Is Null))
... etc...

So yes U can do that.:)

Is there a way to do this in Access or do I have to create 9 different Update queries to accomplish 9 simple operations?
There are situations when 9 simple operation coud be better solution than one that is not simple ;)

Best regards,
Krzemo.
:wave:
Krzemo at 2007-11-9 13:43:23 >
# 2 Re: Performing more than one query in an Access SQL Query?
You can separate many queries using ;
Access editor won't allow this..But if you make a query in an application and call it using OLEDB it should work.
hspc at 2007-11-9 13:44:24 >