Forum Discussion
jennifertaylor
Jan 20, 2022Copper Contributor
IIf Statements with Calculated Fields
Hello. I have a simple database that tracks review dates by term. The terms are monthly, quarterly, semi-annual, and annual. I'm having trouble with the following: I want to be able to create...
Jan 20, 2022
Hi,
DateAdd("m",Switch([Term]="Monthly",1,[Term]="Quarterly",2,[Term]="Semi-Annual",6,[Term]="Annual",12),[ReviewDate])
Servus
Karl
Access News
Access DevCon
- jennifertaylorJan 20, 2022Copper ContributorThat worked! Thank you very much!
- arnel_gpJan 21, 2022Iron Contributor
note, you need to Add 3 (not 2) months to "Quarterly".
also, you will get Error when Term is Blank, so you need another switch:
DateAdd("m",Switch([Term]="Monthly",1,[Term]="Quarterly", 3,[Term]="Semi-Annual",6,[Term]="Annual",12, True, 0),[ReviewDate])
meaning if Term is blank or not in the List, don't add anything (or you have a Default month in mind?)