I have the following IIF statement working in SQL.
ModFlag: IIF(DatePart("ww",[DateModified])=DatePart("ww", Date())-1,IIF(DatePart("ww",[DateModified])=DatePart("ww",Date())-1,-1,0))
I want to make it a VBA procedure so I can call it, by passing a Date to the Function, but I'm missing something simple.
Currently I have this:
Public Function RecModFlag(ModDate as Date)
RecModFlag = IIF(DatePart("ww",ModDate)=DatePart("ww", Date())-1,IIF(DatePart("ww",ModDate)=DatePart("ww",Date())-1,-1,0))
End Function
Trying to troubleshoot, when I do the DatePart on ModDate in the immediate window, I get 52, when put # sign around it, I get the appropriate week number.
End goal, is all of my records have the last time they were modified, and I want to Conditionally Format a box, that will flag if they have been modified, either this week, or the past week.
Thanks in advance for any help or insight.
ModFlag: IIF(DatePart("ww",[DateModified])=DatePart("ww", Date())-1,IIF(DatePart("ww",[DateModified])=DatePart("ww",Date())-1,-1,0))
I want to make it a VBA procedure so I can call it, by passing a Date to the Function, but I'm missing something simple.
Currently I have this:
Public Function RecModFlag(ModDate as Date)
RecModFlag = IIF(DatePart("ww",ModDate)=DatePart("ww", Date())-1,IIF(DatePart("ww",ModDate)=DatePart("ww",Date())-1,-1,0))
End Function
Trying to troubleshoot, when I do the DatePart on ModDate in the immediate window, I get 52, when put # sign around it, I get the appropriate week number.
End goal, is all of my records have the last time they were modified, and I want to Conditionally Format a box, that will flag if they have been modified, either this week, or the past week.
Thanks in advance for any help or insight.