Hi, I have a form where I enter student data and lesson details such as lesson type number of lesson and total cost the following code is supposed to do the calculation to provide the total cost and display it in the txttotal text box.
It doesn't
End Sub
I get this error message: runtime error 2185
"you can't reference a property or method for a control unless the control has the focus"
TIA
WD
It doesn't
Code:
Private Sub txtlessonnum_Exit(Cancel As Integer)
Dim numlessons As Integer
Dim total As Integer
If (Me.cmblesson.Text = "lesson1") Then
total = ((50 / 3) * numlessons)
ElseIf (Me.cmblesson.Text = "lesson2") Then
total = (((50 / 3) * 2) * numlessons)
ElseIf (Me.cmblesson.Text = "lesson3") Then
total = (50 * numlessons)
End If
MsgBox (numlessons)
Me.txttotal.Value = total
'Me.Refresh
End Sub
I get this error message: runtime error 2185
"you can't reference a property or method for a control unless the control has the focus"
TIA
WD