📄 form5.frm
字号:
TabIndex = 18
Top = 1320
Width = 360
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "出生日期"
Height = 180
Left = 120
TabIndex = 17
Top = 960
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "现住址"
Height = 180
Left = 300
TabIndex = 16
Top = 1680
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "籍贯"
Height = 180
Left = 3480
TabIndex = 15
Top = 1320
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "姓名"
Height = 180
Left = 480
TabIndex = 14
Top = 240
Width = 360
End
End
Begin VB.Frame Frame2
Height = 2655
Left = 60
TabIndex = 24
Top = 60
Visible = 0 'False
Width = 5295
Begin VB.TextBox Text2
Height = 315
Left = 1440
TabIndex = 28
Text = "Text2"
Top = 960
Width = 2295
End
Begin VB.TextBox Text1
Height = 315
Left = 1440
TabIndex = 27
Text = "Text1"
Top = 540
Width = 2295
End
Begin VB.CommandButton Command7
Caption = "删除"
Height = 315
Left = 2640
TabIndex = 31
Top = 2220
Width = 1155
End
Begin VB.CommandButton Command6
Caption = "添加"
Height = 315
Left = 1380
TabIndex = 30
Top = 2220
Width = 1155
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "终止卡号"
Height = 180
Left = 660
TabIndex = 26
Top = 1020
Width = 720
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "起始卡号"
Height = 180
Left = 660
TabIndex = 25
Top = 600
Width = 720
End
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "查看明细"
Height = 180
Left = 2580
TabIndex = 23
Top = 3840
Width = 720
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim tags As String
Dim names, bianh As String
Private Sub Command1_Click()
Text1.Text = "": Text2.Text = "": Text3.Text = ""
Text4.Text = "": Text5.Text = "": Text6.Text = ""
Text7.Text = "": Text8.Text = ""
End Sub
Private Sub Command2_Click()
If Text3.Text = "" Then
MsgBox "姓名不能为空!":
Exit Sub:
End If
If Combo1.Text = "" Then
MsgBox "性别不能为空!":
Exit Sub:
End If
If Combo2.Text = "" Then
MsgBox "婚否不能为空!":
Exit Sub:
End If
End Sub
Private Sub Command3_Click()
If Text3.Text = "" Then
MsgBox "姓名不能为空!":
Exit Sub:
End If
If Combo1.Text = "" Then
MsgBox "性别不能为空!":
Exit Sub:
End If
If Combo2.Text = "" Then
MsgBox "婚否不能为空!":
Exit Sub:
End If
Dim str As String
str = "delete from 业务员表 where id=" & DataGrid1.Columns(0).Text
If DoSql(str, False) = True Then
MsgBox "记录删除成功!"
Call inigrid
End If
End Sub
Private Sub Command4_Click()
If Text3.Text = "" Then
MsgBox "姓名不能为空!":
Exit Sub:
End If
If Combo1.Text = "" Then
MsgBox "性别不能为空!":
Exit Sub:
End If
If Combo2.Text = "" Then
MsgBox "婚否不能为空!":
Exit Sub:
End If
Dim str As String
str = "insert into 业务员表(姓名,出生日期,籍贯,婚否,性别,住址,电话,传呼,手机)" & _
" values('" & Trim(Text3.Text) & "','" & DTPicker1.Value & "','" & Trim(Text4.Text) & _
"'," & Combo2.ListIndex & "," & Combo1.ListIndex & ",'" & Trim(Text5.Text) & "','" & _
Trim(Text6.Text) & "','" & Trim(Text7.Text) & "','" & Trim(Text8.Text) & "')"
If DoSql(str, False) = True Then
MsgBox "记录添加成功!"
End If
End Sub
Private Sub Command6_Click()
Dim str As String
str = "insert into 销卡表(业务员id,起始卡号,终止卡号) values(" & bianh & _
",'" & Trim(Text1.Text) & "','" & Trim(Text2.Text) & "')"
If DoSql(str, False) = True Then
MsgBox "记录添加成功!"
Call inigrid
End If
End Sub
Private Sub Command7_Click()
Dim str As String
str = "delete from 销卡表 where 起始卡号='" & Trim(Text1.Text) & "' and 终止卡号='" & Trim(Text2.Text) & "'"
If DoSql(str, False) = True Then
MsgBox "记录删除成功!"
Call inigrid
End If
End Sub
Private Sub DataGrid1_Click()
On Error Resume Next
Text3.Text = DataGrid1.Columns(1).Text
Text4.Text = DataGrid1.Columns(5).Text
Text5.Text = DataGrid1.Columns(7).Text
Text6.Text = DataGrid1.Columns(6).Text
Text7.Text = DataGrid1.Columns(8).Text
Text8.Text = DataGrid1.Columns(9).Text
Combo1.Text = DataGrid1.Columns(2).Text
Combo2.Text = DataGrid1.Columns(3).Text
DTPicker1.Value = DataGrid1.Columns(4).Text
namse = DataGrid1.Columns(1).Text: bianh = DataGrid1.Columns(0).Text
Text1.Text = DataGrid1.Columns(1).Text
Text2.Text = DataGrid1.Columns(2).Text
End Sub
Private Sub DataGrid1_DblClick()
Static i As Integer
i = i + 1
If i Mod 2 = 0 Then
Label12.Caption = "查看明细"
Frame2.Visible = False
Frame1.Visible = True
Else
Label12.Caption = "返回"
namse = DataGrid1.Columns(1).Text: bianh = DataGrid1.Columns(0).Text
Frame2.Visible = True
Frame1.Visible = False
End If
Call inigrid
End Sub
Private Sub Form_Load()
Call inigrid
End Sub
Sub inigrid() '初始化格子
On Error Resume Next
Dim str As String
Adodc1.ConnectionString = constr
Adodc1.CommandType = adCmdTable
If Label12.Caption = "查看明细" Then
Adodc1.RecordSource = "业务查询"
Else
Adodc1.RecordSource = "业务明细"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from 业务明细 where id=" & DataGrid1.Columns(0).Text
End If
Set DataGrid1.DataSource = Adodc1
Adodc1.Refresh
DataGrid1.ReBind
If Adodc1.Recordset.RecordCount = 0 Then
Text1.Text = "": Text2.Text = ""
End If
End Sub
Private Sub Label12_Click()
Static i As Integer
i = i + 1
If i Mod 2 = 0 Then
Label12.Caption = "查看明细"
Frame2.Visible = False
Frame1.Visible = True
Else
Label12.Caption = "返回"
names = DataGrid1.Columns(1).Text: bianh = DataGrid1.Columns(0).Text
Frame2.Visible = True
Frame1.Visible = False
End If
Call inigrid
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
KeyAscii = ValiText(Text6.Text, KeyAscii, "0123456789", True)
End Sub
Private Sub Text8_KeyPress(KeyAscii As Integer)
KeyAscii = ValiText(Text8.Text, KeyAscii, "0123456789", True)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -