0% found this document useful (0 votes)
27 views3 pages

Electricity Bill

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.

Uploaded by

Bharathi Indhu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views3 pages

Electricity Bill

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.

Uploaded by

Bharathi Indhu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

ELECTRICITY BILL

ADD:

Private Sub Command1_Click()


Adodc1.Recordset.AddNew
MsgBox " record added"
End Sub

DELETE:

Private Sub Command2_Click()


Adodc1.Recordset.Delete
MsgBox "record deleted"
End Sub

UPDATE:

Private Sub Command3_Click()


Adodc1.Recordset.Update
MsgBox "record updated"
End Sub

CLEAR:

Private Sub Command4_Click()


Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
End Sub

EXIT:
Private Sub Command5_Click()
End
End Sub

FORM_LOAD():

Private Sub Form_Load()


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

You might also like