I'm having trouble in my discount computation for about a day now and I have to finish my system tomorrow please help me
error appears in rs.close
Code:
Dim a As Double
Dim b As String
Dim Desc As String
Private Sub cbdiscount_Click()
OpenCon
Set rs = New ADODB.Recordset
rs.Open "Select * From [discount] where [Description] = '" & cbdiscount.text & "'", con, adOpenStatic, adLockOptimistic
If rs.RecordCount <> 0 Then
a = rs![Amount]
b = rs![Percent]
Desc = rs![Description]
End If
rs.Close
con.Close
If cbdiscount.Text = "First Honor" Then
OpenCon
Set rs = New ADODB.Recordset
rs.Open "Select * From [fees] where [yearlevel]='" & frmassesment.txtstudlvl.Text & "'", con, adOpenStatic, adLockOptimistic
For x = 1 To rs.RecordCount
frmassesment.lblmisc.Caption = rs![miscfees]
frmassesment.lblothers.Caption = rs![others]
frmassesment.totaltuition.Caption = rs![total]
frmassesment.lbltuition.Caption = rs![tuitionfees]
rs.MoveNext
Next x
If a = 100 Then
lbltuition.Caption = (Val(lbltuition.Caption) * 1)
totaltuition.Caption = (Val(lblothers.Caption)) + (Val(lblmisc.Caption))
ElseIf cbdiscount.Text = "Second Honor" Then
lbltuition.Caption = (Val(lbltuition.Caption) / 0.5)
totaltuition.Caption = (Val(totaltuition.Caption)) + (Val(lblothers.Caption)) + (Val(lblmisc.Caption))
rs.Close
con.Close
End If
End If