-
What is the correct way to code the sum of these variables?
Dim intEarlyBird
Function EarlyRegPrice()
Dim intReg1, intReg2, intReg3
Select Case strReglType 'registration type from the first grouping
Case Individual
intReg1 = 105
Case Spouse
intReg1 = 95
Case ActivePulpitPastor
intReg1 = 75
Case SpecialStudentRate
intReg1 = 75
Case Else --
Response.Redirect "ErrorType.asp"
End Select
Select Case strReg2Type 'registration type from the second grouping
Case Individual
intReg2 = 105
Case Spouse
intReg2 = 95
Case ActivePulpitPastor
intReg2 = 75
Case SpecialStudentRate
intReg2 = 75
Case Else --
Response.Redirect "ErrorType.asp"
End Select
Select Case strReg3Type 'registration type from the third grouping
Case Individual
intReg3 = 105
Case Spouse
intReg3 = 95
Case ActivePulpitPastor
intReg3 = 75
Case SpecialStudentRate
intReg3 = 75
Case Else --
Response.Redirect "ErrorType.asp"
End Select
intEarlyBird = sum(intReg1 - intReg16)
-
<?>
Code:
'One Way
Dim intEarlyBird
Public Function EarlyRegPrice(one As Double, two As Double, three As Double) As Double
intEarlyBird = (one + two + three)
EarlyRegPrice = intEarlyBird
End Function
Public Sub getReg()
Dim intReg1 As Double, intReg2 As Double, intReg3 As Double
Select Case strReglType 'registration type from the first grouping
Case Individual
intReg1 = 105
Case Spouse
intReg1 = 95
Case ActivePulpitPastor
intReg1 = 75
Case SpecialStudentRate
intReg1 = 75
'Case Else --
'Response.Redirect "ErrorType.asp"
End Select
Select Case strReg2Type 'registration type from the second grouping
Case Individual
intReg2 = 105
Case Spouse
intReg2 = 95
Case ActivePulpitPastor
intReg2 = 75
Case SpecialStudentRate
intReg2 = 75
'Case Else --
'Response.Redirect "ErrorType.asp"
End Select
Select Case strReg3Type 'registration type from the third grouping
Case Individual
intReg3 = 105
Case Spouse
intReg3 = 95
Case ActivePulpitPastor
intReg3 = 75
Case SpecialStudentRate
intReg3 = 75
'Case Else --
'Response.Redirect "ErrorType.asp"
End Select
'some dummy info for testing
strReglType = "Spouse"
strReg2Type = "SpecialStudentRate"
strReg3Type = "ActivePulpitPastor"
MsgBox EarlyRegPrice(intReg1, intReg2, intReg3)
End Sub
Private Sub Command1_Click()
getReg
End Sub
-
Great Thanks but I am writing this in ASP. Will this syntax also work?
-
<?>
For ASP I do believe you need to use VBScript or JavaScript and I don't know enought about either to lend a hand. Check around for ASP Forums..there are a lot of them and I do believe some of the pjeople here could help as well.
Sorry.