Hello all,
I am trying to put together a function in a query that will identify and return the correct date in a record. For example, in the below chart:
For my function to work, I need it to return the next upcoming "Scheduled" date, without skipping to another level if there is a blank "Actual" date not listed in the next level. If a "Scheduled" and "Actual" date is filled for level 1, then the function can choose the next "Scheduled" date for the 2nd level. As in, if there is already an actual date in levels 1 and 2, it would choose the next "Scheduled" date in level 3, if there is one. If there is not a "Scheduled" date in level 3, then it can return "Not Required".
In short:
· If actual date is null and schedule date isnull then “Not Required”. Otherwise, Min of the "Scheduled" dates where "Actual" date isnull
Is there a way I can do this in a module with VBA? Thank you in advance for your help!!
I am trying to put together a function in a query that will identify and return the correct date in a record. For example, in the below chart:

For my function to work, I need it to return the next upcoming "Scheduled" date, without skipping to another level if there is a blank "Actual" date not listed in the next level. If a "Scheduled" and "Actual" date is filled for level 1, then the function can choose the next "Scheduled" date for the 2nd level. As in, if there is already an actual date in levels 1 and 2, it would choose the next "Scheduled" date in level 3, if there is one. If there is not a "Scheduled" date in level 3, then it can return "Not Required".
In short:
· If actual date is null and schedule date isnull then “Not Required”. Otherwise, Min of the "Scheduled" dates where "Actual" date isnull
Is there a way I can do this in a module with VBA? Thank you in advance for your help!!