The document contains Visual Basic code for an electricity bill form. It includes subroutines for adding, deleting, and updating records; clearing form fields; exiting the form; loading combo box options; calculating unit usage, rate per unit, and total amount based on form values.
The document contains Visual Basic code for an electricity bill form. It includes subroutines for adding, deleting, and updating records; clearing form fields; exiting the form; loading combo box options; calculating unit usage, rate per unit, and total amount based on form values.
The document contains Visual Basic code for an electricity bill form. It includes subroutines for adding, deleting, and updating records; clearing form fields; exiting the form; loading combo box options; calculating unit usage, rate per unit, and total amount based on form values.
Combo1.AddItem ("Commercial") Combo1.AddItem ("Residental") End Sub
UNIT:
Private Sub Text5_GotFocus()
Text5.Text = Val(Text4.Text) - Val(Text3.Text) End Sub
RATE PER UNIT:
Private Sub Text6_GotFocus()
If Combo1.Text = "Commercial" And Val(Text5.Text) <= 100 Then Text6.Text = 5.5 ElseIf Combo1.Text = "Commercial" And Val(Text5.Text) > 101 And Val(Text5.Text) <= 200 Then Text6.Text = 11.5 ElseIf Combo1.Text = "Commercial" And Val(Text5.Text) > 201 And Val(Text5.Text) <= 300 Then Text6.Text = 15 ElseIf Combo1.Text = "Commercial" And Val(Text5.Text) > 301 Then Text6.Text = 22 ElseIf Combo1.Text = "Residental" And Val(Text5.Text) <= 100 Then Text6.Text = 3.5 ElseIf Combo1.Text = "Residental" And Val(Text5.Text) > 100 And Val(Text5.Text) <= 200 Then Text6.Text = 6.5 ElseIf Combo1.Text = "Residental" And Val(Text5.Text) > 201 And Val(Text5.Text) <= 300 Then Text6.Text = 9.5 ElseIf Combo1.Text = "Residental" And Val(Text5.Text) > 301 Then Text6.Text = 14.25 End If End Sub
AMOUNT:
Private Sub Text7_GotFocus()
Text7.Text = Val(Text5.Text) * Val(Text6.Text) End Sub