📄 frmqufamily.frm
字号:
TabIndex = 16
Top = 1980
Width = 1365
_ExtentX = 2408
_ExtentY = 582
_Version = 393216
BackColor = 16777215
ForeColor = 12582912
MaxLength = 10
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Mask = "##/##/####"
PromptChar = "_"
End
Begin VB.Line Line2
BorderWidth = 2
X1 = 2820
X2 = 3180
Y1 = 2160
Y2 = 2160
End
Begin VB.Line Line3
BorderWidth = 2
X1 = 2820
X2 = 3180
Y1 = 1590
Y2 = 1590
End
Begin VB.Line Line1
BorderWidth = 2
X1 = 2820
X2 = 3180
Y1 = 1020
Y2 = 1020
End
Begin VB.Label Label2
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "工 号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 210
Left = 420
TabIndex = 21
Top = 390
Width = 855
End
Begin VB.Label Label12
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "职 务"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 210
Left = 5490
TabIndex = 20
Top = 1460
Width = 765
End
Begin VB.Label Label1
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "单 位"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 210
Left = 5490
TabIndex = 19
Top = 910
Width = 855
End
Begin VB.Label Label7
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "职 工 名"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 210
Left = 5490
TabIndex = 18
Top = 360
Width = 855
End
Begin VB.Label Label17
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "工作年月"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 210
Left = 420
TabIndex = 17
Top = 2040
Width = 855
End
Begin VB.Label Label16
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "出生年月"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 210
Left = 420
TabIndex = 5
Top = 1490
Width = 855
End
Begin VB.Label Label13
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "来校年月"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 210
Left = 420
TabIndex = 4
Top = 940
Width = 855
End
Begin VB.Label Label4
Height = 435
Left = 420
TabIndex = 3
Top = 1350
Width = 1155
End
Begin VB.Label Label15
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "职 称"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 210
Left = 5490
TabIndex = 2
Top = 2010
Width = 855
End
End
End
Attribute VB_Name = "frmQuFamily"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rec As Recordset
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdInit_Click()
Dim I As Integer
For I = 0 To ShiJF.Count - 1
ShiJF(I) = "__/__/____"
Next I
For I = 0 To ShiJT.Count - 1
ShiJT(I) = "__/__/____"
Next I
For I = 0 To WenB.Count - 1
WenB(I) = ""
Next I
Set rec = dbEstate.OpenRecordset("select * from jiatqk where 工号=''", dbOpenSnapshot)
Set Data1.Recordset = rec
End Sub
Private Sub cmdPrint_Click()
Dim Excel As Object
Dim WorkSheet As Object
Dim WorkBook As Object
Kill App.Path + "\Fa.xls"
Name App.Path + "\Facopy.xls" As App.Path + "\Fa.xls"
FileCopy App.Path + "\Fa.xls", App.Path + "\Facopy.xls"
PrintInExcel rec, "Fa.xls", "m"
Set Excel = CreateObject("Excel.application")
Excel.Workbooks.Open App.Path + "\Fa.xls"
Set WorkBook = Excel.ActiveWorkbook
WorkBook.Worksheets("sample").Select
Set WorkSheet = Excel.ActiveSheet
Excel.Visible = True
WorkBook.Saved = True
End Sub
Private Sub cmdQuery_Click()
Dim bChoice As Boolean
Dim sql As String
Dim nWenB As Integer
Dim nShuZ As Integer
Dim nShiJ As Integer
bChoice = False
nWenB = 0
nShuZ = 0
nShiJ = 0
sql = "select * from jiatqk where "
Dim I As Integer
For I = 0 To rec.Fields.Count - 1
Select Case I
'文本型查询
Case 0, 1, 8, 9, 10:
If Len(Trim(WenB(nWenB))) <> 0 Then
If bChoice Then
sql = sql & "and " + Trim(rec.Fields(I).Name) + " like '*" + Trim(WenB(nWenB)) + "*' "
Else
sql = sql & "" + Trim(rec.Fields(I).Name) + " like '*" + Trim(WenB(nWenB)) + "*' "
bChoice = True
End If
End If
nWenB = nWenB + 1
'时间型查询
Case 5, 6, 7:
If ShiJF(nShiJ) = "__/__/____" And ShiJT(nShiJ) <> "__/__/____" Then
If Not IsDate(ShiJT(nShiJ)) Then
MsgBox "时间形式不正确!", vbExclamation + vbOKOnly, "信息"
ShiJT(nShiJ) = "__/__/____"
Exit Sub
End If
If bChoice Then
sql = sql + "and " + Trim(rec.Fields(I).Name) + " <=" + "#" + "" + Trim(ShiJT(nShiJ).Text) + "" + "#" + " "
Else
sql = sql + "" + Trim(rec.Fields(I).Name) + " <=" + "#" + "" + Trim(ShiJT(nShiJ).Text) + "" + "#" + " "
bChoice = True
End If
End If
If ShiJF(nShiJ).Text <> "__/__/____" And ShiJT(nShiJ) = "__/__/____" Then
If Not IsDate(ShiJF(nShiJ)) Then
MsgBox "时间形式不正确!", vbExclamation + vbOKOnly, "信息"
ShiJF(nShiJ) = "__/__/____"
Exit Sub
End If
If bChoice Then
sql = sql + "and " + Trim(rec.Fields(I).Name) + ">=" + "#" + "" + Trim(ShiJF(nShiJ).Text) + "" + "#" + " "
Else
sql = sql + "" + Trim(rec.Fields(I).Name) + ">=" + "#" + "" + Trim(ShiJF(nShiJ).Text) + "" + "#" + " "
bChoice = True
End If
End If
If ShiJF(nShiJ) <> "__/__/____" And ShiJT(nShiJ) <> "__/__/____" Then
If Not IsDate(ShiJT(nShiJ)) Then
MsgBox "时间形式不正确!", vbExclamation + vbOKOnly, "信息"
ShiJT(nShiJ) = "__/__/____"
Exit Sub
End If
If Not IsDate(ShiJF(nShiJ)) Then
MsgBox "时间形式不正确!", vbExclamation + vbOKOnly, "信息"
ShiJF(nShiJ) = "__/__/____"
Exit Sub
End If
If bChoice Then
sql = sql + "and " + Trim(rec.Fields(I).Name) + " between" + " #" + "" + Trim(ShiJF(nShiJ).Text) + "" + "#" + " and " + "#" + "" + Trim(ShiJT(nShiJ).Text) + "" + "#" + " "
Else
sql = sql + "" + Trim(rec.Fields(I).Name) + " between" + " #" + "" + Trim(ShiJF(nShiJ).Text) + "" + "#" + " and " + "#" + "" + Trim(ShiJT(nShiJ).Text) + "" + "#" + " "
bChoice = True
End If
End If
nShiJ = nShiJ + 1
End Select
Next I
If Not bChoice Then
MsgBox "没有选择条件!", vbExclamation + vbOKOnly, "信息"
Else
Set rec = dbEstate.OpenRecordset(sql, dbOpenSnapshot)
If rec.RecordCount > 0 Then rec.MoveLast
StatusBar1.Panels(1).Text = "共有" & CStr(rec.RecordCount) & "条记录"
Set Data1.Recordset = rec
End If
End Sub
Private Sub Form_Load()
Dim recFind As Recordset
Data1.DatabaseName = App.Path & "\dbestate.mdb"
Set rec = dbEstate.OpenRecordset("select * from jiatqk", dbOpenSnapshot)
InitCombo
End Sub
'添加Combo框的内容
Private Sub InitCombo()
Dim I As Integer
Dim recCombo As Recordset
Dim nWenB As String
nWenB = 0
For I = 0 To rec.Fields.Count - 1
Select Case I
Case 0, 1, 8, 9, 10:
Dim sql As String
sql = "select distinct " + Trim(rec.Fields(I).Name) + " from jiatqk"
Set recCombo = dbEstate.OpenRecordset(sql, dbOpenSnapshot)
If recCombo.RecordCount > 0 Then
recCombo.MoveLast
recCombo.MoveFirst
While Not recCombo.EOF
If Not IsNull(recCombo.Fields(0)) Then WenB(nWenB).AddItem CStr(recCombo.Fields(0))
recCombo.MoveNext
Wend
End If
nWenB = nWenB + 1
End Select
Next I
End Sub
Private Sub Label3_Click()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -