📄 frmmodifycustomer.frm
字号:
Index = 0
Left = 360
TabIndex = 29
Top = 360
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "客户名称:"
Height = 180
Index = 1
Left = 4080
TabIndex = 28
Top = 480
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "性别:"
Height = 180
Index = 2
Left = 360
TabIndex = 27
Top = 975
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "年龄:"
Height = 180
Index = 3
Left = 4080
TabIndex = 26
Top = 1080
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "职业:"
Height = 180
Index = 4
Left = 360
TabIndex = 25
Top = 1605
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "工作单位:"
Height = 180
Index = 5
Left = 4080
TabIndex = 24
Top = 1680
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "身份证:"
Height = 180
Index = 6
Left = 360
TabIndex = 23
Top = 2220
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "邮编:"
Height = 180
Index = 7
Left = 4080
TabIndex = 22
Top = 2280
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "联系地址:"
Height = 180
Index = 8
Left = 360
TabIndex = 21
Top = 2835
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "联系电话:"
Height = 180
Index = 9
Left = 4080
TabIndex = 20
Top = 2880
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "需求面积:"
Height = 180
Index = 10
Left = 360
TabIndex = 19
Top = 3465
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "需求楼层:"
Height = 180
Index = 11
Left = 4080
TabIndex = 18
Top = 3480
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "需求房型:"
Height = 180
Index = 12
Left = 360
TabIndex = 17
Top = 4080
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "备注:"
Height = 180
Index = 13
Left = 4080
TabIndex = 16
Top = 4080
Width = 540
End
End
Begin VB.Frame Frame1
Caption = "Frame1"
Height = 135
Left = 240
TabIndex = 0
Top = 120
Width = 15
End
End
Attribute VB_Name = "frmModifyCustomer"
Attribute VB_GlobalNameSpace = False
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 deleteCommand_Click()
myBookmark = mrc.Bookmark
If MsgBox("是否删除当前记录?", vbOKCancel, "删除当前记录") = 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()
mcclean = False
Frame2.Enabled = False
firstCommand.Enabled = False
previousCommand.Enabled = False
nextCommand.Enabled = False
lastCommand.Enabled = False
Dim i As Integer
For i = 1 To 13
txtfields(i).Enabled = True
Next
myBookmark = mrc.Bookmark
End Sub
Private Sub firstCommand_Click()
mrc.MoveFirst
Call viewData
End Sub
Private Sub Form_Load()
Dim txtSQL As String
Dim MsgText As String
txtSQL = "select * from 客户信息"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.MoveFirst
Call viewData
myBookmark = mrc.Bookmark
mcclean = True
Dim i As Integer
For i = 0 To 13
txtfields(i).Enabled = False
Next
End Sub
Public Sub viewData()
Dim i As Integer
For i = 0 To 13
txtfields(i).Text = mrc.Fields(i)
Next
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 updateCommand_Click()
If mcclean Then
MsgBox "请先修改客户信息", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
mrc.Fields(1) = Trim(txtfields(1).Text)
mrc.Fields(2) = Trim(txtfields(2).Text)
mrc.Fields(3) = Val(txtfields(3).Text)
mrc.Fields(4) = Trim(txtfields(4).Text)
mrc.Fields(5) = Trim(txtfields(5).Text)
mrc.Fields(6) = Val(txtfields(6).Text)
mrc.Fields(7) = Val(txtfields(7).Text)
mrc.Fields(8) = Trim(txtfields(8).Text)
mrc.Fields(9) = Trim(txtfields(9).Text)
mrc.Fields(10) = Val(txtfields(10).Text)
mrc.Fields(11) = Val(txtfields(11).Text)
mrc.Fields(12) = Trim(txtfields(12).Text)
mrc.Fields(13) = Trim(txtfields(13).Text)
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
Dim i As Integer
For i = 0 To 13
txtfields(i).Enabled = False
Next
mcclean = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -