I am having a problem with the following 2 expressions.
The 1st expression contains a DateAdd function and is used in the 2nd expression.
Expr1: IIf([FLSAStatus]="N",Format(DateAdd("m",6,[HireDate]),"mm/dd"),"07/01")
Expr2: CDate(IIf((Format(Date(),"mm/dd")<=[Expr1]),Format(([Expr1] & "/" & Year(Date())),"mm/dd/yyyy"),Format(([Expr1] & "/" & (Year(Date())+1)),"mm/dd/yyyy")))
When I try to sort on Expr2, I get a Data Type mismatch error. I think the problem is that the first expression has the DateAdd function in it. When I remove it, I no longer get the error. I assumed that Expr1 would be a String datatype b/c of the Format() function. And, I assumed that Expr2 was also a String datatype - that is why I converted it with the CDate() function.
I don't care what datatype Expr1 is, but I need to use the DateAdd function to add 6 months (using [HireDate] + 180 is NOT what I want). And, Expr2 needs to be Date datatype.
I'm not sure how to fix my problem.
Anyone??
The 1st expression contains a DateAdd function and is used in the 2nd expression.
Expr1: IIf([FLSAStatus]="N",Format(DateAdd("m",6,[HireDate]),"mm/dd"),"07/01")
Expr2: CDate(IIf((Format(Date(),"mm/dd")<=[Expr1]),Format(([Expr1] & "/" & Year(Date())),"mm/dd/yyyy"),Format(([Expr1] & "/" & (Year(Date())+1)),"mm/dd/yyyy")))
When I try to sort on Expr2, I get a Data Type mismatch error. I think the problem is that the first expression has the DateAdd function in it. When I remove it, I no longer get the error. I assumed that Expr1 would be a String datatype b/c of the Format() function. And, I assumed that Expr2 was also a String datatype - that is why I converted it with the CDate() function.
I don't care what datatype Expr1 is, but I need to use the DateAdd function to add 6 months (using [HireDate] + 180 is NOT what I want). And, Expr2 needs to be Date datatype.
I'm not sure how to fix my problem.
Anyone??