stevekos07
Registered User.
- Local time
- Today, 11:56
- Joined
- Jul 26, 2015
- Messages
- 174
I have a rather complex expression in an unbound calculated field on a form. This started out much simpler than it is now, but as more and more conditions have been added to the expression it has now become too unwieldy to manage as an expression.
I am thinking of converting it to a Select Case statement either as an OnLoad event on the field, or as a public function that I can call from anywhere.
I am not unfamiliar with Select Case but I have not written one personally. Any help would be greatly appreciated.
This is the expression:
=IIf(Date()=[NoCallFrom]
Or Date()>=[NoCallFrom] And Date()<=[NoCallTo]
Or Date()=[NoCallFrom2]
Or Date()>=[NoCallFrom2] And Date()<=[NoCallTo2]
Or Weekday(Date(),1)=1 And [Sun]=True
Or Date()>=[NCUFN_Date]
Or [Status]=3
Or [Status]=4
Or Weekday(Date(),1)=2 And [Mon]=True
Or Weekday(Date(),1)=3 And [Tue]=True
Or Weekday(Date(),1)=4 And [Wed]=True
Or Weekday(Date(),1)=5 And [Thu]=True
Or Weekday(Date(),1)=6 And [Fri]=True
Or Weekday(Date(),1)=7 And [Sat]=True
Or [P/H]=True And DLookUp("HolDate","tblPublicHolidays","HolDate=Date()"),"No","Yes")
I am thinking of converting it to a Select Case statement either as an OnLoad event on the field, or as a public function that I can call from anywhere.
I am not unfamiliar with Select Case but I have not written one personally. Any help would be greatly appreciated.
This is the expression:
=IIf(Date()=[NoCallFrom]
Or Date()>=[NoCallFrom] And Date()<=[NoCallTo]
Or Date()=[NoCallFrom2]
Or Date()>=[NoCallFrom2] And Date()<=[NoCallTo2]
Or Weekday(Date(),1)=1 And [Sun]=True
Or Date()>=[NCUFN_Date]
Or [Status]=3
Or [Status]=4
Or Weekday(Date(),1)=2 And [Mon]=True
Or Weekday(Date(),1)=3 And [Tue]=True
Or Weekday(Date(),1)=4 And [Wed]=True
Or Weekday(Date(),1)=5 And [Thu]=True
Or Weekday(Date(),1)=6 And [Fri]=True
Or Weekday(Date(),1)=7 And [Sat]=True
Or [P/H]=True And DLookUp("HolDate","tblPublicHolidays","HolDate=Date()"),"No","Yes")