IFF Statement Help with DateAdd (1 Viewer)

jam465

New member
Local time
Today, 06:25
Joined
Mar 14, 2019
Messages
2
I'm using the following code successfully to calculate a date of five weeks before the end date. I need to wrap it up by calculating a date of three weeks before the end date for courses that do not have MPA in crs_comp1 or P in crs_comp3. In a nutshell, all other courses would fall into the bucket of having a date assignment of three weeks before the end date. I've tried :banghead:and I've tried :banghead:to code that in, but having DateAdd and the formatting at the end in place is evidently beyond my abilities for being able to make an IFF statement behave as usual to assign the other value to remaining courses. Any tips on how to code in the rest will be greatly appreciated.

Course Eval Start Date: Format(IIf([dbo_section_master_v.crs_comp1]='MPA' Or [dbo_section_master_v.crs_comp3] Like "*p*",DateAdd("ww",-5,[dbo_section_master_v.last_end_dte])),'mm/dd/yyyy')
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:25
Joined
Aug 30, 2003
Messages
36,124
Try this untested stab at it:

Format(IIf([dbo_section_master_v.crs_comp1]='MPA' Or [dbo_section_master_v.crs_comp3] Like "*p*",DateAdd("ww",-5,[dbo_section_master_v.last_end_dte]), DateAdd("ww",-3,[dbo_section_master_v.last_end_dte])),'mm/dd/yyyy')
 

jam465

New member
Local time
Today, 06:25
Joined
Mar 14, 2019
Messages
2
Thanks! That worked and you are hired!

Have a good one.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:25
Joined
Aug 30, 2003
Messages
36,124
Happy to help!
 

Users who are viewing this thread

Top Bottom