views:

42

answers:

2

I am using MS Access 2003 SP3 and I need to write a statement that says something like this:

I have two columns, one is the [MaxOfDate] field and the other is the [Date-Inidicator] field. For several of these rows, the Date-Indicator is blank. I want to tell MS Access that if the [MaxOfDate] field is a date of ""99991231" then enter "A" in [Date-Indicator]. How do I write this in an IF STATEMENT?

Thank you, Debbie

+1  A: 

iif ( condition, value_if_true, value_if_false )

iif ([Qty] > 5, "greater than 5", "less than 5")

Spooks
Is that what you want if Qty = 5?
HansUp
A: 

If you want to store "A" in [Date-Indicator] for rows where [MaxOfDate] = "99991231", use an UPDATE statement:

UPDATE YourTable
SET [Date-Indicator] = "A"
WHERE [MaxOfDate] = "99991231";

That example assumes MaxOfDate is text data type. If it is actually Date/Time data type, enclose the date with # characters to let the database engine know it's a date value:

UPDATE YourTable
SET [Date-Indicator] = "A"
WHERE [MaxOfDate] = #9999/12/31#;
HansUp