frmygzcc.frm
来自「企业工资管理系统的具体实现」· FRM 代码 · 共 557 行 · 第 1/2 页
FRM
557 行
Height = 300
Left = 5700
TabIndex = 16
Top = 330
Width = 2040
End
Begin VB.CommandButton Command3
Caption = "退 出"
Height = 405
Left = 10485
TabIndex = 15
Top = 1005
Width = 945
End
Begin VB.CommandButton Command2
Caption = "全部查询"
Height = 405
Left = 9525
TabIndex = 14
Top = 1005
Width = 945
End
Begin VB.CommandButton Command1
Caption = "选择查询"
Height = 405
Left = 8565
TabIndex = 13
Top = 1005
Width = 945
End
Begin VB.TextBox Text5
Enabled = 0 'False
Height = 345
Left = 5700
TabIndex = 12
Top = 915
Width = 2130
End
Begin VB.CheckBox Check4
Caption = "姓 名:"
Height = 375
Left = 4515
TabIndex = 11
Top = 900
Width = 1200
End
Begin VB.TextBox Text4
Enabled = 0 'False
Height = 345
Left = 1650
TabIndex = 10
Top = 915
Width = 2205
End
Begin VB.CheckBox Check3
Caption = "职工代号:"
Height = 390
Left = 525
TabIndex = 9
Top = 915
Width = 1200
End
Begin VB.CheckBox Check2
Caption = "车间代号:"
Height = 345
Left = 4500
TabIndex = 8
Top = 330
Width = 1215
End
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 345
Left = 2745
TabIndex = 6
Top = 300
Width = 735
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 345
Left = 1380
TabIndex = 4
Top = 300
Width = 885
End
Begin VB.CheckBox Check1
Caption = "月份:"
Height = 300
Left = 525
TabIndex = 3
Top = 360
Width = 840
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "月"
Height = 180
Left = 3615
TabIndex = 7
Top = 390
Width = 180
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "年"
Height = 180
Left = 2415
TabIndex = 5
Top = 405
Width = 180
End
End
End
Attribute VB_Name = "frmygzcc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Check1_Click()
If Check1.Value = 1 Then
Text1.Enabled = True
Text2.Enabled = True
ElseIf Check1.Value = 0 Then
Text1.Enabled = False
Text2.Enabled = False
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
Combo1.Enabled = True
ElseIf Check2.Value = 0 Then
Combo1.Enabled = False
End If
End Sub
Private Sub Check3_Click()
If Check3.Value = 1 Then
Text4.Enabled = True
ElseIf Check3.Value = 0 Then
Text4.Enabled = False
End If
End Sub
Private Sub Check4_Click()
If Check4.Value = 1 Then
Text5.Enabled = True
ElseIf Check4.Value = 0 Then
Text5.Enabled = False
End If
End Sub
Private Sub Command1_Click()
Dim sql As String
Dim yf As String
If Check1.Value = 0 And Check2.Value = 0 And Check3.Value = 0 And Check4.Value = 0 Then
MsgBox "请选择你要查询的条件!", vbInformation, "提示"
Exit Sub
End If
If Check1.Value = 1 Then
If IsNumeric(Text1.Text) = False Then
MsgBox "输入的年份不是数字,请重输!", vbInformation, "提示"
Text1.Text = ""
Text1.SetFocus
Exit Sub
ElseIf Len(Trim(Text1.Text)) <> 4 Or Val(Trim(Text1.Text)) < 2000 Then
MsgBox "输入的年份应为4位,或者年份应该在2000年以后!", vbInformation, "提示"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
If IsNumeric(Text2.Text) = False Then
MsgBox "输入的月份不是数字,请重输!", vbInformation, "提示"
Text2.Text = ""
Text2.SetFocus
Exit Sub
ElseIf Len(Trim(Text2.Text)) <> 2 Or (Val(Trim(Text2.Text)) < 0 Or Val(Trim(Text2.Text)) > 12) Then
MsgBox "输入的月份长度或大小不正确!格式:“06”", vbInformation, "提示"
Text2.Text = ""
Text2.SetFocus
Exit Sub
End If
End If
sql = "select * from ygzqkb where "
yf = Trim(Text1.Text) & "年" & Trim(Text2.Text) & "月"
If Check1.Value = 1 Then sql = sql & "yf='" & yf & "'"
If Check1.Value = 1 And Check2.Value = 1 Then
sql = sql & " and cjdh='" & Trim(Combo1.Text) & "'"
ElseIf Check1.Value = 0 And Check2.Value = 1 Then
sql = sql & "cjdh='" & Trim(Combo1.Text) & "'"
End If
If Check1.Value = 1 Then
If Check2.Value = 1 Then
If Check3.Value = 1 Then
sql = sql & " and grdh='" & Trim(Text4.Text) & "'"
End If
Else
If Check3.Value = 1 Then
sql = sql & " and grdh='" & Trim(Text4.Text) & "'"
End If
End If
Else
If Check2.Value = 1 Then
If Check3.Value = 1 Then
sql = sql & " and grdh='" & Trim(Text4.Text) & "'"
End If
Else
If Check3.Value = 1 Then
sql = sql & "grdh='" & Trim(Text4.Text) & "'"
End If
End If
End If
If Check1.Value = 1 Then
If Check2.Value = 1 Then
If Check3.Value = 1 Then
If Check4.Value = 1 Then
sql = sql & " and xm='" & Trim(Text5.Text) & "'"
End If
Else
If Check4.Value = 1 Then
sql = sql & " and xm='" & Trim(Text5.Text) & "'"
End If
End If
Else
If Check4.Value = 1 Then
sql = sql & " and xm='" & Trim(Text5.Text) & "'"
End If
End If
Else
If Check2.Value = 1 Then
If Check4.Value = 1 Then
sql = sql & " and xm='" & Trim(Text5.Text) & "'"
End If
Else
If Check3.Value = 1 Then
If Check4.Value = 1 Then
sql = sql & " and xm='" & Trim(Text5.Text) & "'"
End If
Else
If Check4.Value = 1 Then
sql = sql & "xm='" & Trim(Text5.Text) & "'"
End If
End If
End If
End If
With Adodc1
.ConnectionString = constr
.RecordSource = sql & " order by yf and grdh"
.Refresh
If .Recordset.EOF And .Recordset.BOF Then
MsgBox "没有查到符合条件的记录!", vbInformation, "提示"
End If
End With
End Sub
Private Sub Command2_Click()
With Adodc1
.ConnectionString = constr
.RecordSource = "select * from ygzqkb order by yf and grdh"
.Refresh
End With
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
With Adodc1
.ConnectionString = constr
.RecordSource = "select * from ygzqkb order by yf and grdh"
.Refresh
End With
Set DataGrid1.DataSource = Adodc1
Call frmwork(frmygzcc)
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?