📄 main_xszz_ywygl_lr.frm
字号:
VERSION 5.00
Begin VB.Form main_xszz_ywygl_lr
BorderStyle = 3 'Fixed Dialog
Caption = "Form1"
ClientHeight = 3000
ClientLeft = 45
ClientTop = 330
ClientWidth = 6885
Icon = "main_xszz_ywygl_lr.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3000
ScaleWidth = 6885
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "确定"
Height = 390
Left = 1770
TabIndex = 10
Top = 2505
Width = 1770
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 390
Left = 3660
TabIndex = 9
Top = 2505
Width = 1770
End
Begin VB.Frame Frame1
Height = 2460
Left = 0
TabIndex = 0
Top = -75
Width = 6885
Begin VB.TextBox Text1
Height = 330
Index = 7
Left = 1215
TabIndex = 18
Top = 2025
Width = 5565
End
Begin VB.TextBox Text1
Height = 330
Index = 6
Left = 1215
TabIndex = 17
Top = 1650
Width = 5565
End
Begin VB.TextBox Text1
Height = 330
Index = 5
Left = 1215
TabIndex = 16
Top = 1275
Width = 5565
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1215
TabIndex = 11
Text = "Combo1"
Top = 555
Width = 2340
End
Begin VB.TextBox Text1
Height = 330
Index = 1
Left = 4440
TabIndex = 5
Top = 165
Width = 2340
End
Begin VB.TextBox Text1
Height = 330
Index = 2
Left = 4455
TabIndex = 4
Top = 540
Width = 2340
End
Begin VB.TextBox Text1
Height = 330
Index = 3
Left = 1215
TabIndex = 3
Top = 900
Width = 2340
End
Begin VB.TextBox Text1
Height = 330
Index = 0
Left = 1215
Locked = -1 'True
TabIndex = 2
Top = 180
Width = 2340
End
Begin VB.TextBox Text1
Height = 330
Index = 4
Left = 4440
TabIndex = 1
Top = 900
Width = 2340
End
Begin VB.Label Label9
Caption = "备注"
Height = 165
Left = 750
TabIndex = 20
Top = 2115
Width = 390
End
Begin VB.Label Label8
Caption = "联系地址"
Height = 165
Left = 420
TabIndex = 19
Top = 1755
Width = 720
End
Begin VB.Label Label7
Caption = "其他联系方式"
Height = 165
Left = 90
TabIndex = 15
Top = 1365
Width = 1455
End
Begin VB.Label Label6
Caption = "手机号码"
Height = 165
Left = 3660
TabIndex = 14
Top = 990
Width = 720
End
Begin VB.Label Label5
Caption = "联系电话"
Height = 165
Left = 435
TabIndex = 13
Top = 990
Width = 720
End
Begin VB.Label Label4
Caption = "身份证号"
Height = 165
Left = 3675
TabIndex = 12
Top = 630
Width = 720
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "编号"
ForeColor = &H000000FF&
Height = 165
Left = 750
TabIndex = 8
Top = 225
Width = 375
End
Begin VB.Label Label2
Caption = "姓名"
ForeColor = &H000000FF&
Height = 165
Left = 4005
TabIndex = 7
Top = 255
Width = 375
End
Begin VB.Label Label3
Caption = "性别"
Height = 165
Left = 750
TabIndex = 6
Top = 630
Width = 405
End
End
End
Attribute VB_Name = "main_xszz_ywygl_lr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text1(2).SetFocus
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Text1(1).SetFocus
End Sub
Private Sub Form_Load()
Combo1.AddItem "女"
Combo1.AddItem "男"
Combo1.ListIndex = 0
If blnAddYWY = True Then
Me.Caption = "业务员信息添加"
rs1.Open "select * from 业务员表 order by 编号", Cnn, adOpenKeyset
If rs1.RecordCount > 0 Then
rs1.MoveLast
Text1(0) = Format(Val(rs1.Fields("编号")) + 1, "0000")
Else
Text1(0) = "0001"
End If
rs1.Close
For i = 1 To Text1.UBound
Text1(i) = ""
Next i
Else
Me.Caption = "业务员信息修改"
With main_xszz_ywygl.Adodc1.Recordset
Text1(0) = .Fields(0)
Text1(1) = .Fields(1)
If .Fields(2) <> "" Then Combo1.text = .Fields(2)
For i = 2 To Text1.UBound
If .Fields(i + 1) <> "" Then Text1(i) = .Fields(i + 1)
Next i
End With
End If
End Sub
Private Sub Text1_GotFocus(Index As Integer)
Text1(Index).BackColor = &HFFFF00
Text1(Index).SelStart = 0
Text1(Index).SelLength = Len(Text1(Index))
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn And Index = 1 Then Combo1.SetFocus
If KeyCode = vbKeyReturn And Index < 7 And Index >= 2 Then Text1(Index + 1).SetFocus
If KeyCode = vbKeyReturn And Index = 7 Then Command1.SetFocus
End Sub
Private Sub Text1_LostFocus(Index As Integer)
Text1(Index).BackColor = &H80000005
End Sub
Private Sub Command1_Click()
On Error GoTo SaveErr
If blnAddYWY = True Then
Cnn.Execute ("insert into 业务员表 values('" + Text1(0) + "','" + Text1(1) + "','" + Combo1 + _
"','" + Text1(2) + "','" + Text1(3) + "','" + Text1(4) + "','" + Text1(5) + "','" + Text1(6) + _
"','" + Text1(7) + "','" + Str(Date) + "')")
Else
Cnn.Execute ("update 业务员表 set 姓名 ='" + Text1(1) + "',性别='" + Combo1 + "',身份证号='" + Text1(2) + _
"',联系电话 ='" + Text1(3) + "',手机号码='" + Text1(4) + "',其他联系方式='" + Text1(5) + "',联系地址='" + _
Text1(6) + "',备注='" + Text1(7) + "'where 编号 ='" + Text1(0) + "'")
End If
main_xszz_ywygl.Adodc1.Refresh
If YWYBookmark <> "" Then main_xszz_ywygl.DataGrid1.Bookmark = YWYBookmark
Unload Me
Exit Sub
SaveErr:
MsgBox Err.Description
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -