Reputation: 55
I have created a report in Access. Inside the report is a textbox whose name is "CountOfVotes". The box uses the formula =Count(*). This adds up the number of votes awarded for a performance. There are several different performances. I have created another textbox called "Round". I want to write an IF, ELSEIF, ELSE statement that uses the number of Votes to calculate what round a performance has reached. For example
If CountOfVotes >3 Then
Output "You have reached Round 3"
ElseIf CountOfVotes =2 Then
Output "You have reached round 2"
Else
Output "You have only reached round 1"
End If
What is the correct syntax to write this procedure in the Code Builder??
Many thanks for any help
Upvotes: 0
Views: 547
Reputation: 55816
You can use Choose in an expression like this as ControlSource for your textbox:
=Choose(Count(*),"You have only reached round 1","You have reached round 2","You have reached Round 3")
or a little fancier if this is quite fixed:
="You have " & IIf(Count(*)=1,"only ","") & "reached round" & Str(Count(*))
This, however, will not be blank (Null) for a count of zero.
Upvotes: 1