?? frmcustomer.frm
字號:
Name = "宋體"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 105
TabIndex = 16
Top = 3195
Width = 1095
End
Begin VB.Label Label5
Alignment = 2 'Center
Caption = "電話:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4140
TabIndex = 15
Top = 600
Width = 1215
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "聯(lián)系地址:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 270
TabIndex = 14
Top = 1365
Width = 1410
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "住戶姓名:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 390
TabIndex = 13
Top = 645
Width = 1365
End
End
Attribute VB_Name = "frmCustomer"
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mrc As ADODB.Recordset
Dim myBookmark As Variant
Dim mcclean As Boolean
Private Sub cancelCommand_Click()
Unload Me
End Sub
Private Sub cmdAdd_Click()
ModifyFlag = False
mcclean = False
Frame2.Enabled = False
firstCommand.Enabled = False
previousCommand.Enabled = False
nextCommand.Enabled = False
lastCommand.Enabled = False
txtCustomerNO.Enabled = True
txtName.Enabled = True
txtPhone.Enabled = True
TxtAddress.Enabled = True
txtComment.Enabled = True
txtPrePay.Enabled = True
txtUnPay.Enabled = True
txtCustomerNO.Text = ""
txtName.Text = ""
txtPhone.Text = ""
TxtAddress.Text = ""
txtComment.Text = ""
txtPrePay.Text = ""
txtUnPay.Text = ""
myBookmark = mrc.Bookmark
End Sub
Private Sub deleteCommand_Click()
myBookmark = mrc.Bookmark
If MsgBox("是否刪除當(dāng)前記錄?", vbOKCancel, "刪除當(dāng)前記錄") = vbOK Then
mrc.MoveNext
If mrc.EOF Then
mrc.MoveFirst
myBookmark = mrc.Bookmark
mrc.MoveLast
mrc.Delete
mrc.Bookmark = myBookmark
Call viewData
Else
myBookmark = mrc.Bookmark
mrc.MovePrevious
mrc.Delete
mrc.Bookmark = myBookmark
Call viewData
End If
Else
mrc.Bookmark = myBookmark
Call viewData
End If
End Sub
Private Sub editCommand_Click()
ModifyFlag = True
mcclean = False
Frame2.Enabled = False
firstCommand.Enabled = False
previousCommand.Enabled = False
nextCommand.Enabled = False
lastCommand.Enabled = False
txtName.Enabled = True
txtPhone.Enabled = True
TxtAddress.Enabled = True
txtComment.Enabled = True
txtPrePay.Enabled = True
txtUnPay.Enabled = True
myBookmark = mrc.Bookmark
End Sub
Private Sub firstCommand_Click()
mrc.MoveFirst
Call viewData
End Sub
Private Sub Form_Load()
ModifyFlag = True
UserName = "dfa"
Dim txtSQL As String
Dim MsgText As String
txtSQL = "select * from Customer"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.MoveFirst
Call viewData
myBookmark = mrc.Bookmark
mcclean = True
End Sub
Public Sub viewData()
txtCustomerNO.Text = mrc.Fields(0)
txtName.Text = mrc.Fields(1)
txtPhone.Text = mrc.Fields(2)
TxtAddress.Text = mrc.Fields(3)
txtComment.Text = mrc.Fields(4)
txtPrePay.Text = mrc.Fields(5)
txtUnPay.Text = mrc.Fields(6)
txtModifyName.Text = mrc.Fields(7)
txtModifyDate.Text = mrc.Fields(8)
End Sub
Private Sub Label2_Click()
End Sub
Private Sub lastCommand_Click()
mrc.MoveLast
Call viewData
End Sub
Private Sub nextCommand_Click()
mrc.MoveNext
If mrc.EOF Then
mrc.MoveFirst
End If
Call viewData
End Sub
Private Sub previousCommand_Click()
mrc.MovePrevious
If mrc.BOF Then
mrc.MoveLast
End If
Call viewData
End Sub
Private Sub Text3_Change()
End Sub
Private Sub txtModifyName_Change()
End Sub
Private Sub txtName_Change()
End Sub
Private Sub txtPrePay_Change()
End Sub
Private Sub updateCommand_Click()
Dim txtSQL As String
Dim MsgText As String
Dim mrcc As ADODB.Recordset
If mcclean Then
MsgBox "請先修改住戶資料信息信息", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
If Not Testtxt(txtCustomerNO.Text) Then
MsgBox "請輸入住戶編號!", vbOKOnly + vbExclamation, "警告"
txtCustomerNO.SetFocus
Exit Sub
End If
If Not Testtxt(txtName.Text) Then
MsgBox "請輸入住戶名稱!", vbOKOnly + vbExclamation, "警告"
txtName.SetFocus
Exit Sub
End If
If Not Testtxt(txtPhone.Text) Then
MsgBox "請輸入電話!", vbOKOnly + vbExclamation, "警告"
txtName.SetFocus
Exit Sub
End If
If Not Testtxt(TxtAddress.Text) Then
MsgBox "請輸入聯(lián)系地址!", vbOKOnly + vbExclamation, "警告"
txtName.SetFocus
Exit Sub
End If
If Not IsNumeric(txtPrePay.Text) Then
MsgBox "請輸入預(yù)付款!", vbOKOnly + vbExclamation, "警告"
txtPhone.SetFocus
Exit Sub
End If
If Not IsNumeric(txtUnPay.Text) Then
MsgBox "請輸入欠款!", vbOKOnly + vbExclamation, "警告"
TxtAddress.SetFocus
Exit Sub
End If
If ModifyFlag = True Then
mrc.Delete
End If
txtSQL = "select * from Customer where CustomerNO = '" & Trim(txtCustomerNO.Text) & "'"
Set mrcc = ExecuteSQL(txtSQL, MsgText)
If mrcc.EOF = False Then
MsgBox "學(xué)號重復(fù),請重新輸入!", vbOKOnly + vbExclamation, "警告"
mrcc.Close
txtCustomerNO.SetFocus
Else
mrcc.Close
mrc.AddNew
mrc.Fields(0) = Trim(txtCustomerNO.Text)
mrc.Fields(1) = Trim(txtName.Text)
mrc.Fields(2) = Trim(txtPhone.Text)
mrc.Fields(3) = Trim(TxtAddress.Text)
mrc.Fields(4) = Trim(txtComment.Text)
mrc.Fields(5) = Trim(txtPrePay.Text)
mrc.Fields(6) = Trim(txtUnPay.Text)
mrc.Fields(7) = UserName
mrc.Fields(8) = CStr(Date)
mrc.Update
MsgBox "住戶資料信息更新成功!", vbOKOnly + vbExclamation, "住戶資料信息信息更新"
mrc.Bookmark = myBookmark
Call viewData
Frame2.Enabled = True
firstCommand.Enabled = True
previousCommand.Enabled = True
nextCommand.Enabled = True
lastCommand.Enabled = True
txtCustomerNO.Enabled = False
txtName.Enabled = False
txtPhone.Enabled = False
TxtAddress.Enabled = False
txtPrePay.Enabled = False
txtUnPay.Enabled = False
mcclean = True
End If
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -