Hello All,
I am in need of some advice....
I am running a search box that a person can select 1 or more items ("Priorities"). I need to run some complex (not hard just lengthy) custom queries but I don't know the best route to take.
As it stands now, I would have to put in a multiple multiple IIF statement...
i.e. Days Remaining: iif([Priority] = "Priority 1", "Due Now", iif([Priority] = "Priority 2", iif([Open Date] + 7) >= Date, ............. etc.
I will show you a little bit of the code that I wrote to set the text boxes (independent of this query) that runs similar logic and that should make the above statement make more sense.
I just don't know the best way to handle this as you can see, the nested nested nested iif statements in the query would get rather lengthy and confusing.
Any advice would be great!
Stoss
I am in need of some advice....
I am running a search box that a person can select 1 or more items ("Priorities"). I need to run some complex (not hard just lengthy) custom queries but I don't know the best route to take.
As it stands now, I would have to put in a multiple multiple IIF statement...
i.e. Days Remaining: iif([Priority] = "Priority 1", "Due Now", iif([Priority] = "Priority 2", iif([Open Date] + 7) >= Date, ............. etc.
I will show you a little bit of the code that I wrote to set the text boxes (independent of this query) that runs similar logic and that should make the above statement make more sense.
Code:
ElseIf strPriority = "Priority 2 (7-Days)" Then
If ([OPEN_DATE] + 7) >= Date Then
If ([OPEN_DATE] + 7) <> Date Then
Me.txtClosedBy = "This discrepancy is " & DateDiff("d"[OPEN_DATE], Date) & " day(s) old and must be closed by " & DateAdd("d", DateDiff("d", Date - 7, [OPEN_DATE]), Date) & ". (" & DateDiff("d", Date - 7, [OPEN_DATE]) & " day(s) remaining)"
Else
Me.txtClosedBy = "This discrepancy is due today!"
End If
Else
Me.txtClosedBy = "This discrepancy is past due by " & DateDiff("d", [OPEN_DATE] + 7, Date) & " day(s)."
End If
I just don't know the best way to handle this as you can see, the nested nested nested iif statements in the query would get rather lengthy and confusing.
Any advice would be great!
Stoss