I am trying to build a simple dice rolling program in Access to use with generating characters in D&D. I can't figure out how to write it to keep the three highest numbers.
Here is what I was able to get on my own which works fine unless two of the numbers are the same.
'compare and keep best three
If Dice1 < Dice2 And Dice1 < Dice3 And Dice1 < Dice4 Then
FourdSix = Dice2 + Dice3 + Dice4
ElseIf Dice2 < Dice1 And Dice2 < Dice3 And Dice2 < Dice4 Then
FourdSix = Dice1 + Dice3 + Dice4
ElseIf Dice3 < Dice1 And Dice3 < Dice2 And Dice3 < Dice4 Then
FourdSix = Dice1 + Dice2 + Dice4
ElseIf Dice4 < Dice1 And Dice4 < Dice2 And Dice4 < Dice3 Then
FourdSix = Dice1 + Dice2 + Dice3
Else
MsgBox "Error, didn't work."
End If