I created a table (Table1) with fields
TestID_PK (Autonumber) PK
LEI_Date (Date)
Step (Number - Integer)
I entered the provided date from Post #1.
I created a query:
Code:
SELECT Table1.LEI_Date, Table1.Step, IIf([STEP]<=3,[LEI_Date]+(364),IIf([Step] Between 4 And 6,[LEI_Date]+(728),IIf([STEP]>=7,[LEI_date]+(1092),""))) AS WIGI_DueDate
FROM Table1;
The results of the query:
LEI_Date |
Step |
WIGI_DueDate |
1/3/2021 |
1 |
1/2/2022 |
1/3/2021 |
2 |
1/2/2022 |
1/3/2021 |
3 |
1/2/2022 |
1/3/2021 |
4 |
1/1/2023 |
1/3/2021 |
5 |
1/1/2023 |
1/3/2021 |
6 |
1/1/2023 |
1/3/2021 |
7 |
12/31/2023 |
1/3/2021 |
8 |
12/31/2023 |
1/3/2021 |
9 |
12/31/2023 |
The formula could also be written
Code:
IIF([STEP] <= 3,[LEI_Date] +(52*7), IIF([Step] >= 4 and Step <= 6, [LEI_Date] +(104*7), IIF([STEP] >=7, [LEI_date] +(156*7),""))) AS WIGI_DueDate
OR
IIF([STEP] <= 3,[LEI_Date] +(52*7), IIF([Step] Between 4 and 6, [LEI_Date] +(104*7), IIF([STEP] >=7 , [LEI_date] +(156*7),""))) AS WIGI_DueDate
OR
IIf([STEP] <= 3,[LEI_Date] +(364), IIf([Step] Between 4 And 6, [LEI_Date] +(728), IIf([STEP]>=7 ,[LEI_date] +(1092),""))) AS WIGI_DueDate