liam1289
08-18-2010, 09:49 AM
i am trying to make a calculation. i have 2 options boxes and 2 checkboxes. both in different frames. when one option box is selected the other frame is disbaled. but if the other option is selected you have to choose a checkbox. when check boxes are checked singley they add up correctly but when 2 are selected it doesnt work
.the code i have used is
Private Sub CmdCalculate_Click()
Dim card As Double
Dim cost As Double
If optmedcard = True Then
msg = "No Charge to card holders!"
Buttons = vbInformation
Title = "Medical Card Holder"
MsgBox msg, Buttons, Title
End If
If optmedno = True And chkcalout = False And Chkstandard = False Then
msg = "Please Select Option from the other frame"
Buttons = vbInformation
Title = "Not a Card Holder"
MsgBox msg, Buttons, Title
End If
If chkcalout = True Then
card = card + 15
End If
If Chkstandard = True Then
cost = cost + 35
End If
If chkcalout = True Then
msg = "Callout Cost = " & card & vbCrLf & "Cost = " & cost & vbCrLf & "Total Order =" & (15 + Chkstandard)
Buttons = vbInformation
Title = "Total Cost"
MsgBox msg, Buttons, Title
ElseIf Chkstandard = True Then
msg = "Standard Cost = " & card & vbCrLf & "Card = " & cost & vbCrLf & "Total Order =" & (chkcalout + 35)
Buttons = vbInformation
Title = "Total Cost"
MsgBox msg, Buttons, Title
ElseIf Chkstandard And chkcalout = True Then
msg = "Standard Cost = " & card & vbCrLf & "Card = " & cost & vbCrLf & "Total Order =" & (15 + 35)
Buttons = vbInformation
Title = "Total Cost"
MsgBox msg, Buttons, Title
End If
End Sub
Private Sub cmdexit_Click()
msg = "Are you sure you want to exit?"
Buttons = vbYesNo + vbDefaultButton2
Title = "Exiting Westdoc System"
Reply = MsgBox(msg, Buttons, Title)
If Reply = vbYes Then
End
End If
End Sub
Private Sub optmedcard_Click()
Frame2.Enabled = False
End Sub
Private Sub optmedno_Click()
Frame2.Enabled = True
End Sub
.the code i have used is
Private Sub CmdCalculate_Click()
Dim card As Double
Dim cost As Double
If optmedcard = True Then
msg = "No Charge to card holders!"
Buttons = vbInformation
Title = "Medical Card Holder"
MsgBox msg, Buttons, Title
End If
If optmedno = True And chkcalout = False And Chkstandard = False Then
msg = "Please Select Option from the other frame"
Buttons = vbInformation
Title = "Not a Card Holder"
MsgBox msg, Buttons, Title
End If
If chkcalout = True Then
card = card + 15
End If
If Chkstandard = True Then
cost = cost + 35
End If
If chkcalout = True Then
msg = "Callout Cost = " & card & vbCrLf & "Cost = " & cost & vbCrLf & "Total Order =" & (15 + Chkstandard)
Buttons = vbInformation
Title = "Total Cost"
MsgBox msg, Buttons, Title
ElseIf Chkstandard = True Then
msg = "Standard Cost = " & card & vbCrLf & "Card = " & cost & vbCrLf & "Total Order =" & (chkcalout + 35)
Buttons = vbInformation
Title = "Total Cost"
MsgBox msg, Buttons, Title
ElseIf Chkstandard And chkcalout = True Then
msg = "Standard Cost = " & card & vbCrLf & "Card = " & cost & vbCrLf & "Total Order =" & (15 + 35)
Buttons = vbInformation
Title = "Total Cost"
MsgBox msg, Buttons, Title
End If
End Sub
Private Sub cmdexit_Click()
msg = "Are you sure you want to exit?"
Buttons = vbYesNo + vbDefaultButton2
Title = "Exiting Westdoc System"
Reply = MsgBox(msg, Buttons, Title)
If Reply = vbYes Then
End
End If
End Sub
Private Sub optmedcard_Click()
Frame2.Enabled = False
End Sub
Private Sub optmedno_Click()
Frame2.Enabled = True
End Sub