0% found this document useful (0 votes)
13 views

123679

The document contains code for an accounting application user interface. It includes subroutines for querying, inserting, modifying, and deleting accounting codes from a worksheet. It also contains code to initialize the form, close the form, and return to the main form.

Uploaded by

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

123679

The document contains code for an accounting application user interface. It includes subroutines for querying, inserting, modifying, and deleting accounting codes from a worksheet. It also contains code to initialize the form, close the form, and return to the main form.

Uploaded by

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

Dim r As Integer

Private Sub ActiveForm_Initialize()


txtActNo.Text = ""
txtActName.Text = ""
btnActQuery.Enabled = True
btnActIns.Enabled = False
btnActModify.Enabled = False
btnActDel.Enabled = False
btnActCls.Enabled = True
btnActReturn.Enabled = True
txtActNo.SetFocus
End Sub

Private Sub btnActQuery_Click()


f=0
r=1
Do While Cells(r, "A") <> ""
If Cells(r, "A") = txtActNo.Text Then
txtActName.Text = Cells(r, "B")
f=1
Exit Do
End If
r=r+1
Loop
If f = 0 Then
btnActQuery.Enabled = True
btnActIns.Enabled = True
btnActModify.Enabled = False
btnActDel.Enabled = False
txtActName.SetFocus
Else
btnActQuery.Enabled = True
btnActIns.Enabled = False
btnActModify.Enabled = True
btnActDel.Enabled = True
txtActName.SetFocus
End If
End Sub
Private Sub btnActIns_Click()
r = ThisWorkbook.Worksheets("科目表").Cells(Rows.Count, "A").End(xlUp).Row
ThisWorkbook.Worksheets("科目表").Cells(r + 1, "A") = txtActNo.Text
ThisWorkbook.Worksheets("科目表").Cells(r + 1, "B") = txtActName.Text
MsgBox ("新增完成!!")
txtActNo.Text = ""
txtActName.Text = ""
btnActQuery.Enabled = True
btnActIns.Enabled = False
btnActModify.Enabled = False
btnActDel.Enabled = False
txtActNo.SetFocus
End Sub
Private Sub btnActModify_Click()
ThisWorkbook.Sheets("科目表").Cells(r, "A") = txtActNo.Text
ThisWorkbook.Sheets("科目表").Cells(r, "B") = txtActName.Text
MsgBox ("修改完成!!")
txtActNo.Text = ""
txtActName.Text = ""
btnActQuery.Enabled = True
btnActIns.Enabled = False
btnActModify.Enabled = False
btnActDel.Enabled = False
txtActNo.SetFocus
End Sub
Private Sub btnActDel_Click()
ThisWorkbook.Worksheets ("科目表"), Rows(r).EntireRow.Delete
MsgBox ("刪除完成!!")
btnActQuery.Enabled = True
btnActIns.Enabled = False
btnActModify.Enabled = False
btnActDel.Enabled = False
txtActNo.Text = ""
txtActName.Text = ""
txtActNo.SetFocus
End Sub
Private Sub btnActCls_Click()
btnActQuery.Enabled = True
btnActIns.Enabled = False
btnActModify.Enabled = False
btnActDel.Enabled = False
txtActNo.Text = ""
txtActName.Text = ""
End Sub
Private Sub btnActReturn_Click()
Unload UserActForm
UserMainForm.Show
End Sub

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy