I am trying to write a function which calculates the stableford score for a golfers round. Unfortunately, I am quite new to access and my coding experience is with Progress Open Edge.
I have attached the code I have attempted to write below, any help would be greatly appreciated.
I have attached the code I have attempted to write below, any help would be greatly appreciated.
Code:
Private Function calcStblFrd()
Dim iScore As Integer
Dim iPoints As Integer
Dim iPar As Integer
Dim iStrokes As Integer
Dim iAllow As Integer
Dim iHcap As Integer
Dim iStrInd As Integer
Dim iHcapDif As Integer
iHcap = 28
iStrInd = 7
iPar = 5
iStrokes = 5
If iHcap <= 18 Then
If iStrInd <= iHcap Then
iAllow = 1
Else
iAllow = 0
End If
ElseIf iHcap > 18 Then
iHcapDif = iHcap - 18
If iHcapDif <= 10 Then
If iStrInd <= iHcapDif Then
iAllow = 2
Else
iAllow = 1
End If
End If
End If
iScore = (iStrokes - iAllow) - iPar
Select Case iScore
Case -5
iScore = 7
Case -4
iScore = 6
Case -3
iScore = 5
Case -2
iScore = 4
Case -1
iScore = 3
Case 0
iScore = 2
Case 1
iScore = 1
Case Else
iScore = 0
End Select
End Function