Expression Builder in QBE

jpl458

Well-known member
Local time
Today, 08:36
Joined
Mar 30, 2012
Messages
1,218
I am trying to create a calculated field in QBE grid using this code

Code:
LST: IIf([Mastertbl3.calldate]>#3/12/2022#  OR <#11/5/2022#,"Yes","No")

Calculating if date is in DST ot LST

But keep getting this error,

1671560833626.png


Thanks
 
Try
LST: IIf([Mastertbl3.calldate]>#3/12/2022# OR [Mastertbl3.calldate]<#11/5/2022#,"Yes","No")
 
looks like you are missing a couple of square brackets - and you need to use the expression as suggested by XPS35

[Mastertbl3].[calldate]

and just checking - your dates are in the format mm/dd/yyyy?
 
I'm not sure you have your logic right. Perhaps its my americanism showing through:

>#3/12/2022# OR <#11/5/2022#

Is that March 12th and November 5th or December 3rd and May 11th?

If its March/November, then that expression will never be false. If its December/May, then it might be correct.
 
LST: IIf([Mastertbl3.calldate]>#3/12/2022# OR [Mastertbl3.calldate]<#11/5/2022#,"Yes","No")
I'm going to assume that the dates are not actually hardcoded in the IIf().
Are you sure you want a string returned? What are you doing with the "Yes" and "No"?
 
Try
LST: IIf([Mastertbl3.calldate]>#3/12/2022# OR [Mastertbl3.calldate]<#11/5/2022#,"Yes","No")
Try
LST: IIf([Mastertbl3.calldate]>#3/12/2022# OR [Mastertbl3.calldate]<#11/5/2022#,"Yes","No")
I assumed too much. Thanks.
I'm not sure you have your logic right. Perhaps its my americanism showing through:

>#3/12/2022# OR <#11/5/2022#

Is that March 12th and November 5th or December 3rd and May 11th?

If its March/November, then that expression will never be false. If its December/May, then it might be correct.
I found that and fixed it. And instead of OR.

Code:
LST: IIf([Mastertbl3.calldate]>#3/12/2022# And [Mastertbl3.calldate]<#11/5/2022#,"Yes","No")

Works correctly.
 

Users who are viewing this thread

Back
Top Bottom