Allen
Allen

Reputation: 1

Update query in Microsoft Access 2007

I need to update multiple fields in a table. If there is already data in one field I want to insert the data in the next field. Example: Date1 Date2 Date3

If there is a date in Date1 then populate Date2, if there is a date in Date 1 and Date2 then populate Date3 and so on.

Upvotes: 0

Views: 956

Answers (1)

Thomas
Thomas

Reputation: 64635

Update Table
Set Date2 = IIF( Not IsNull( Date1 ), SomeDateValue, Date2 )
    , Date3 = IIF( Not IsNull( Date1 ) And Not IsNull( Date2 ), SomeDateValue, Date3 )

The question isn't clear regarding to what Date2 or Date3 should be set if other criteria is true. In this case, I presumed it was some value (SomeDateValue) which hasn't been mentioned.

Upvotes: 1

Related Questions