📄 frmrencl.frm
字号:
.TextMatrix(0, 9) = "工作日期"
.TextMatrix(0, 10) = "院系"
.TextMatrix(0, 11) = "社会兼职"
.TextMatrix(0, 12) = "籍贯"
.TextMatrix(0, 13) = "身份证号"
Do While Not mrc.EOF
.Rows = .Rows + 1
.CellAlignment = 4
.TextMatrix(.Rows - 1, 0) = "" & mrc.Fields(0)
.TextMatrix(.Rows - 1, 1) = "" & mrc.Fields(1)
.TextMatrix(.Rows - 1, 2) = "" & mrc.Fields(2)
.TextMatrix(.Rows - 1, 3) = "" & mrc.Fields(3)
.TextMatrix(.Rows - 1, 4) = "" & mrc.Fields(4)
.TextMatrix(.Rows - 1, 5) = "" & mrc.Fields(5)
.TextMatrix(.Rows - 1, 6) = "" & mrc.Fields(6)
.TextMatrix(.Rows - 1, 7) = "" & Format(mrc.Fields(7), "yyyy-mm-dd")
.TextMatrix(.Rows - 1, 8) = "" & mrc.Fields(8)
.TextMatrix(.Rows - 1, 9) = "" & Format(mrc.Fields(9), "yyyy-mm-dd")
.TextMatrix(.Rows - 1, 10) = "" & mrc.Fields(10)
.TextMatrix(.Rows - 1, 11) = "" & mrc.Fields(11)
.TextMatrix(.Rows - 1, 12) = "" & mrc.Fields(12)
.TextMatrix(.Rows - 1, 13) = "" & mrc.Fields(13)
'移动到下一条记录
mrc.MoveNext
Loop
End With
Label1.Caption = txtSQL
End Sub
Private Sub cmdcha_Click()
tt = tt Mod 2
If tt = 1 Then
Label1.Visible = False
Else
Label1.Visible = True
End If
tt = tt + 1
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdInquire_Click()
On Error GoTo OOPS
Dim txtSQL As String
Dim MsgText As String
Dim dd(4) As Boolean
Dim mrc As ADODB.Recordset
Dim smaninf As String
Dim smfind As String
Dim sman As ADODB.Recordset
Call intform
smaninf = "select * from personfind"
Set sman = ExecuteSQL(smaninf, smfind)
txtSQL = "select * from personnel_infor where "
'判断是否选择第一查询方式
If Check1(0).value Then
If Trim(Text1.Text) = "" Then
sMeg = "查询不能为空!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Exit Sub
Else
dd(0) = True
If Cbo_Operator(0).ListIndex = 0 Then
txtSQL = txtSQL & "" & myquery(0) & " " & Cbo_Operator(0).Text & " '%" & Text1.Text & "%'"
Else
txtSQL = txtSQL & "" & myquery(0) & " " & Cbo_Operator(0).Text & " '" & Text1.Text & "'"
End If
End If
End If
'判断是否选择第二查询方式
If Check1(1).value Then
If Trim(Text2.Text) = "" Then
sMeg = "查询不能为空!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Exit Sub
Else
dd(1) = True
If dd(0) Then
'组合查询语句
If Cbo_Operator(1).ListIndex = 0 Then
txtSQL = txtSQL & " and " & myquery(1) & " " & Cbo_Operator(1).Text & " '%" & Text2.Text & "%'"
Else
txtSQL = txtSQL & " and " & "" & myquery(1) & " " & Cbo_Operator(1).Text & " '" & Text2.Text & "'"
End If
Else
If Cbo_Operator(1).ListIndex = 0 Then
txtSQL = txtSQL & "" & myquery(1) & " " & Cbo_Operator(1).Text & " '%" & Text2.Text & "%'"
Else
txtSQL = txtSQL & " " & "" & myquery(1) & " " & Cbo_Operator(1).Text & " '" & Text2.Text & "'"
End If
End If
End If
End If
'判断是否选择第三查询方式
If Check1(2).value Then
'判断是否输入教研室
If Trim(Text3.Text) = "" Then
sMeg = "查询不能为空!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
Text3.SetFocus
Exit Sub
Else
dd(2) = True
If dd(0) Or dd(1) Then
'组合查询语句
If Cbo_Operator(2).ListIndex = 0 Then
txtSQL = txtSQL & " and " & myquery(2) & " " & Cbo_Operator(2).Text & " '%" & Text3.Text & "%'"
Else
txtSQL = txtSQL & " and " & "" & myquery(2) & " " & Cbo_Operator(2).Text & " '" & Text3.Text & "'"
End If
Else
If Cbo_Operator(2).ListIndex = 0 Then
txtSQL = txtSQL & "" & myquery(2) & " " & Cbo_Operator(2).Text & " '%" & Text3.Text & "%'"
Else
txtSQL = txtSQL & "" & "" & myquery(2) & " " & Cbo_Operator(2).Text & " '" & Text3.Text & "'"
End If
End If
End If
End If
'判断是否设置查询方式
If Not (dd(0) Or dd(1) Or dd(2) Or dd(3)) Then
MsgBox "请设置查询方式!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
'查询所有满足条件的内容
txtSQL = txtSQL & " order by personnel_id"
'执行查询语句
Set mrc = ExecuteSQL(txtSQL, MsgText)
'将查询内容显示在表格控件中
Label1.Caption = txtSQL
With myflexgrid
.Rows = 1
.CellAlignment = 4
.TextMatrix(0, 0) = "人员编号"
.TextMatrix(0, 1) = "姓名"
.TextMatrix(0, 2) = "性别"
.TextMatrix(0, 3) = "职称"
.TextMatrix(0, 4) = "职务"
.TextMatrix(0, 5) = "学历"
.TextMatrix(0, 6) = "教研室"
.TextMatrix(0, 7) = "出生日期"
.TextMatrix(0, 8) = "政治面貌"
.TextMatrix(0, 9) = "工作日期"
.TextMatrix(0, 10) = "院系"
.TextMatrix(0, 11) = "社会兼职"
.TextMatrix(0, 12) = "籍贯"
.TextMatrix(0, 13) = "身份证号"
'判断是否移动到数据集对象的最后一条记录
Do While Not mrc.EOF
.Rows = .Rows + 1
.CellAlignment = 4
'为personfind添加记录
sman.AddNew
.TextMatrix(.Rows - 1, 0) = "" & mrc.Fields(0)
sman.Fields(0) = mrc.Fields(0)
.TextMatrix(.Rows - 1, 1) = "" & mrc.Fields(1)
sman.Fields(1) = mrc.Fields(1)
.TextMatrix(.Rows - 1, 2) = "" & mrc.Fields(2)
sman.Fields(2) = mrc.Fields(2)
.TextMatrix(.Rows - 1, 3) = "" & mrc.Fields(3)
sman.Fields(3) = "" & mrc.Fields(3)
.TextMatrix(.Rows - 1, 4) = "" & mrc.Fields(4)
sman.Fields(4) = "" & mrc.Fields(4)
.TextMatrix(.Rows - 1, 5) = "" & mrc.Fields(5)
sman.Fields(5) = "" & mrc.Fields(5)
.TextMatrix(.Rows - 1, 6) = "" & mrc.Fields(6)
sman.Fields(6) = mrc.Fields(6)
.TextMatrix(.Rows - 1, 7) = "" & Format(mrc.Fields(7), "yyyy-mm-dd")
sman.Fields(7) = mrc.Fields(7)
.TextMatrix(.Rows - 1, 8) = "" & mrc.Fields(8)
sman.Fields(8) = mrc.Fields(8)
.TextMatrix(.Rows - 1, 9) = "" & Format(mrc.Fields(9), "yyyy-mm-dd")
sman.Fields(9) = mrc.Fields(9)
.TextMatrix(.Rows - 1, 10) = "" & mrc.Fields(10)
sman.Fields(10) = mrc.Fields(10)
.TextMatrix(.Rows - 1, 11) = "" & mrc.Fields(11)
sman.Fields(11) = mrc.Fields(11)
.TextMatrix(.Rows - 1, 12) = "" & mrc.Fields(12)
sman.Fields(12) = mrc.Fields(12)
.TextMatrix(.Rows - 1, 13) = "" & mrc.Fields(13)
sman.Fields(13) = mrc.Fields(13)
'移动到下一条记录
sman.MoveNext
mrc.MoveNext
Loop
If myflexgrid.Rows = 1 Then GoTo OOPS
End With
'关闭数据集
mrc.Close
Exit Sub
OOPS:
MsgBox "没发现相符记录!"
End Sub
Private Sub Command2_Click()
Dim numpf As Integer
Dim personsql As String
Dim perf As ADODB.Recordset
Dim tx As String
personsql = "select * from personfind"
Set perf = ExecuteSQL(personsql, tx)
numpf = 0
If Not perf.EOF Then
perf.MoveFirst
Do While Not perf.EOF
numpf = numpf + 1
'移动到下一条记录
perf.MoveNext
Loop
perf.Close
End If
drpersonfind.Show
drpersonfind.Sections(2).Controls("label4").Caption = "查询到 :" & numpf & "条记录"
End Sub
Private Sub Command3_Click()
drperson.Show
End Sub
'初始化网格
Private Sub Form_Load()
Dim txtSQL As String
Dim MsgText As String
Dim dd(4) As Boolean
Dim mrc As ADODB.Recordset
tt = 0
Label1.Visible = False
With myflexgrid
.ColWidth(0) = 1000
.ColWidth(1) = 800
.ColWidth(2) = 500
.ColWidth(3) = 1000
.ColWidth(4) = 1000
.ColWidth(5) = 700
.ColWidth(6) = 1200
.ColWidth(7) = 1050
.ColWidth(8) = 800
.ColWidth(9) = 1050
.ColWidth(10) = 1000
.ColWidth(11) = 1200
.ColWidth(12) = 1200
.ColWidth(13) = 1800
.CellAlignment = 4
.TextMatrix(0, 0) = "人员编号"
.TextMatrix(0, 1) = "姓名"
.TextMatrix(0, 2) = "性别"
.TextMatrix(0, 3) = "职称"
.TextMatrix(0, 4) = "职务"
.TextMatrix(0, 5) = "学历"
.TextMatrix(0, 6) = "教研室"
.TextMatrix(0, 7) = "出生日期"
.TextMatrix(0, 8) = "政治面貌"
.TextMatrix(0, 9) = "工作日期"
.TextMatrix(0, 10) = "院系"
.TextMatrix(0, 11) = "社会兼职"
.TextMatrix(0, 12) = "籍贯"
.TextMatrix(0, 13) = "身份证号"
End With
For i = 0 To 2
Cbo_Category(i).AddItem "人员编号"
Cbo_Category(i).AddItem "姓名"
Cbo_Category(i).AddItem "性别"
Cbo_Category(i).AddItem "职称"
Cbo_Category(i).AddItem "职务"
Cbo_Category(i).AddItem "学历"
Cbo_Category(i).AddItem "教研室"
Cbo_Category(i).AddItem "出生日期"
Cbo_Category(i).AddItem "政治面貌"
Cbo_Category(i).AddItem "院系"
Cbo_Category(i).AddItem "社会兼职"
Cbo_Category(i).AddItem "籍贯"
Cbo_Category(i).AddItem "身份证号"
Cbo_Category(i).ListIndex = 0
Cbo_Operator(i).ListIndex = 0
Next i
'显示所有记录
txtSQL = "select * from personnel_infor "
Set mrc = ExecuteSQL(txtSQL, MsgText)
With myflexgrid
.Rows = 1
.CellAlignment = 4
.TextMatrix(0, 0) = "人员编号"
.TextMatrix(0, 1) = "姓名"
.TextMatrix(0, 2) = "性别"
.TextMatrix(0, 3) = "职称"
.TextMatrix(0, 4) = "职务"
.TextMatrix(0, 5) = "学历"
.TextMatrix(0, 6) = "教研室"
.TextMatrix(0, 7) = "出生日期"
.TextMatrix(0, 8) = "政治面貌"
.TextMatrix(0, 9) = "工作日期"
.TextMatrix(0, 10) = "院系"
.TextMatrix(0, 11) = "社会兼职"
.TextMatrix(0, 12) = "籍贯"
.TextMatrix(0, 13) = "身份证号"
Do While Not mrc.EOF
.Rows = .Rows + 1
.CellAlignment = 4
.TextMatrix(.Rows - 1, 0) = "" & mrc.Fields(0)
.TextMatrix(.Rows - 1, 1) = "" & mrc.Fields(1)
.TextMatrix(.Rows - 1, 2) = "" & mrc.Fields(2)
.TextMatrix(.Rows - 1, 3) = "" & mrc.Fields(3)
.TextMatrix(.Rows - 1, 4) = "" & mrc.Fields(4)
.TextMatrix(.Rows - 1, 5) = "" & mrc.Fields(5)
.TextMatrix(.Rows - 1, 6) = "" & mrc.Fields(6)
.TextMatrix(.Rows - 1, 7) = "" & Format(mrc.Fields(7), "yyyy-mm-dd")
.TextMatrix(.Rows - 1, 8) = "" & mrc.Fields(8)
.TextMatrix(.Rows - 1, 9) = "" & Format(mrc.Fields(9), "yyyy-mm-dd")
.TextMatrix(.Rows - 1, 10) = "" & mrc.Fields(10)
.TextMatrix(.Rows - 1, 11) = "" & mrc.Fields(11)
.TextMatrix(.Rows - 1, 12) = "" & mrc.Fields(12)
.TextMatrix(.Rows - 1, 13) = "" & mrc.Fields(13)
'移动到下一条记录
mrc.MoveNext
Loop
End With
End Sub
Public Sub intform()
Dim txs As String
Dim man As String
Dim rs As ADODB.Recordset
txs = "delete from personfind"
Set rs = ExecuteSQL(txs, man)
Unload drpersonfind
Unload DataEnvironment1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -