📄 frmsearch1.frm
字号:
ColumnWidth = 524.976
EndProperty
BeginProperty Column04
ColumnWidth = 989.858
EndProperty
BeginProperty Column05
ColumnWidth = 629.858
EndProperty
BeginProperty Column06
ColumnWidth = 569.764
EndProperty
BeginProperty Column07
ColumnWidth = 585.071
EndProperty
BeginProperty Column08
ColumnWidth = 840.189
EndProperty
BeginProperty Column09
ColumnWidth = 1230.236
EndProperty
BeginProperty Column10
ColumnWidth = 689.953
EndProperty
BeginProperty Column11
ColumnWidth = 1154.835
EndProperty
BeginProperty Column12
ColumnWidth = 1170.142
EndProperty
BeginProperty Column13
ColumnWidth = 540.284
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 1800
Top = 0
Visible = 0 'False
Width = 2415
_ExtentX = 4260
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database\企业工资管理系统.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database\企业工资管理系统.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "职工信息表"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.TextBox Text2
Height = 375
Left = 7440
TabIndex = 10
Top = 4560
Width = 1695
End
Begin VB.CommandButton Command3
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 6720
TabIndex = 9
Top = 5400
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "重置查询"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4200
TabIndex = 8
Top = 5400
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "开始查询"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1560
TabIndex = 7
Top = 5400
Width = 1335
End
Begin VB.TextBox Text1
Height = 375
Left = 4080
TabIndex = 5
Top = 4560
Width = 1335
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "查询结果:"
BeginProperty Font
Name = "隶书"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 2
Top = 1800
Width = 1455
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "员工姓名:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 6360
TabIndex = 6
Top = 4560
Width = 1335
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "员工编号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2880
TabIndex = 4
Top = 4560
Width = 1215
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "请输入查询的条件:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 3
Top = 4560
Width = 2175
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "所有职工:"
BeginProperty Font
Name = "隶书"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 0
Top = 120
Width = 1575
End
End
Attribute VB_Name = "frmSearch1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim flag As Integer
Private Sub cxchenggong()
'查询成功
'Dim i
'i = 0
'On Error GoTo xserr
'Data1.Recordset.MoveFirst
'Do While Data1.Recordset.EOF <> True
' If Adodc1.Recordset.Fields("工号").Value = Data1.Recordset.Fields("工号").Value Then
' i = 1
' Exit Do
' End If
'Data1.Recordset.MoveNext
'Loop
'xserr:
DataGrid2.Visible = True
Label2.Visible = True
'Adodc2.RecordSource = " select * from 职工工资明细表 where 员工姓名='" & Adodc1.Recordset.Fields("员工编号").Value & ""
If flag = 1 Then Adodc2.RecordSource = " select * from 职工工资结算表 where 员工编号='" & Text1.Text & "'"
If flag = 2 Then Adodc2.RecordSource = " select * from 职工工资结算表 where 员工姓名='" & Text2.Text & "'"
If flag = 3 Then Adodc2.RecordSource = " select * from 职工工资结算表 where 员工编号='" & Text1.Text & "' and 员工姓名='" & Text2.Text & "'"
Adodc2.Refresh
End Sub
Private Sub Command1_Click()
On Error GoTo chaxunerr
DataGrid1.Height = 700
DataGrid1.Top = 480
Dim i
i = 0
flag = 0 '1表示只使用编号查询,2表示只使用姓名查询,3表示使用编号和姓名组合查询
If Text1.Text <> "" And Text2.Text = "" Then
'员工编号查询
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF <> True
If Text1.Text = Adodc1.Recordset.Fields("员工编号").Value Then
i = 1
flag = 1
Exit Do
End If
Adodc1.Recordset.MoveNext
Loop
ElseIf Text1.Text = "" And Text2.Text <> "" Then
'员工姓名查询
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF <> True
If Text2.Text = Adodc1.Recordset.Fields("员工姓名").Value Then
i = 1
flag = 2
Exit Do
End If
Adodc1.Recordset.MoveNext
Loop
Else
'以员工编号和员工姓名查询
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF <> True
If Text1.Text = Adodc1.Recordset.Fields("员工编号").Value _
And Text2.Text = Adodc1.Recordset.Fields("员工姓名").Value Then
i = 1
flag = 3
Exit Do
End If
Adodc1.Recordset.MoveNext
Loop
End If
chaxunerr:
If i = 1 Then
DataGrid1.BackColor = &HC0E0FF
chenggong = MsgBox("查询成功!", vbOKOnly + vbExclamation, "查询")
If chenggong = 1 Then
Call cxchenggong
End If
Else:
DataGrid1.Height = 3255
DataGrid1.Top = 480
MsgBox "查无此记录!", vbOKOnly + vbExclamation, "提示"
End If
End Sub
Private Sub Command2_Click()
'DataGrid1.BackColor = &HFFFFFF
DataGrid2.Visible = False
DataGrid1.Height = 3255
DataGrid1.Top = 480
Adodc1.Recordset.MoveFirst
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End Sub
Private Sub Command3_Click()
Me.Hide
Unload Me
Exit Sub
End Sub
Private Sub Form_Activate()
Label2.Visible = False
DataGrid2.Visible = False
Adodc1.Recordset.MoveFirst
DataGrid1.Height = 2500
DataGrid1.Top = 480
'DataGrid1.BackColor = &HFFFFFF
'Command2.Enabled = False
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -