📄 frmxjbg.frm
字号:
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
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 MSComCtl2.DTPicker DTPicker2
BeginProperty DataFormat
Type = 1
Format = "yyyy-MM-dd"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 3
EndProperty
Height = 300
Left = 11130
TabIndex = 7
Top = 1770
Width = 1290
_ExtentX = 2275
_ExtentY = 529
_Version = 393216
Format = 23789569
CurrentDate = 37696
End
Begin MSComCtl2.DTPicker DTPicker1
BeginProperty DataFormat
Type = 1
Format = "yyyy-MM-dd"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 3
EndProperty
Height = 300
Left = 11115
TabIndex = 8
Top = 1365
Width = 1290
_ExtentX = 2275
_ExtentY = 529
_Version = 393216
Format = 23789569
CurrentDate = 37696
End
Begin VB.Label Label1
Caption = "姓 名"
Height = 285
Index = 5
Left = 10530
TabIndex = 15
Top = 2370
Width = 450
End
Begin VB.Label Label1
Caption = "日 期:"
Height = 285
Index = 0
Left = 10470
TabIndex = 14
Top = 1395
Width = 990
End
Begin VB.Label Label5
Caption = "至"
Height = 285
Left = 10770
TabIndex = 13
Top = 1770
Width = 270
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "巡 检 报 告"
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 360
Index = 1
Left = 3840
TabIndex = 12
Top = 120
Width = 3255
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "总记录数:"
Height = 180
Left = 8280
TabIndex = 11
Top = 450
Width = 810
End
Begin VB.Label LabZJL
Caption = "0"
Height = 240
Left = 9300
TabIndex = 10
Top = 450
Width = 750
End
Begin VB.Label Label1
Caption = "次 数"
Height = 285
Index = 2
Left = 10530
TabIndex = 9
Top = 2850
Width = 450
End
End
Attribute VB_Name = "FrmXJBG"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rst As New ADODB.Recordset
Dim sql As String
Private Sub CmdSetup_click() '打印设置按钮的单击事件
On Error Resume Next
CommonDialog1.Flags = cdlPDPrintSetup
CommonDialog1.CancelError = True
On Error GoTo ErrorHandle:
CommonDialog1.ShowPrinter
Me.Refresh
ErrorHandle:
End Sub
Private Sub Commclose_click()
On Error Resume Next
Unload Me
End Sub
Private Sub Commmquery_Click()
On Error Resume Next
sql = ""
sql = "select * from 巡检报告 where 日期 between #" + Format(DTPicker1.Value, "yyyy-mm-dd") + "# and #" + Format(DTPicker2.Value, "yyyy-mm-dd") + "#"
If Trim(CombA.Text) <> "" Then
sql = sql + "and 值班员='" + Trim(CombA.Text) + "'"
End If
If Trim(CombCS.Text) <> "" And Val(Trim(CombCS.Text)) > 0 Then
sql = sql & "and 次数=" & Trim(CombCS.Text)
End If
sql = sql & "order by 日期CX DESC"
Adodc1.RecordSource = Trim(sql)
Adodc1.Refresh
LabZJL.Caption = Adodc1.Recordset.RecordCount '总记录数
End Sub
Private Sub CommPrint_click()
On Error Resume Next
If sql = "" Then
Exit Sub
End If
Me.Refresh
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseClient
rst.Open Adodc1.RecordSource, adocn, adOpenDynamic, adLockOptimistic, adCmdText
Set ReportXJCX.DataSource = rst
ReportXJCX.Sections(1).Controls(1).Caption = Format(DTPicker1.Value, "yyyy年mm月dd日") & "至" & Format(DTPicker2.Value, "yyyy年mm月dd日")
ReportXJCX.Sections(1).Controls(1).Caption = gUserName
ReportXJCX.Sections(1).Controls(6).Caption = Trim(LabZJL.Caption)
ReportXJCX.Show vbModal
rst.Close
End Sub
Private Sub DTPicker1_Change()
On Error Resume Next
If DTPicker1.Value = DTPicker2.Value Then
Call FindCS
Else
CombCS.Text = ""
CombCS.Enabled = False
End If
End Sub
Private Sub DTPicker2_Change()
On Error Resume Next
If DTPicker1.Value = DTPicker2.Value Then
Call FindCS
Else
CombCS.Text = ""
CombCS.Enabled = False
End If
End Sub
Private Sub Form_load()
On Error Resume Next
DTPicker1.Value = Now
DTPicker2.Value = Now
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseClient
'名字
CombA.Clear
CombA.Text = ""
rst.Open "select * from userduty ", adocn, adOpenDynamic, adLockOptimistic, adCmdText
Do While Not rst.EOF
CombA.AddItem Trim(rst![姓名])
rst.MoveNext
Loop
rst.Close
Adodc1.ConnectionString = adocnsting
Call FindCS
End Sub
Private Sub FindCS()
On Error Resume Next
Dim int1 As Integer
CombCS.Enabled = True
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseClient
sql = "select DISTINCT 次数 from 巡检报告 where 日期 =#" + Format(DTPicker1.Value, "yyyy-mm-dd") + "#"
'次数
CombCS.Clear
CombCS.Text = ""
rst.Open sql, adocn, adOpenDynamic, adLockOptimistic, adCmdText
Do While Not rst.EOF
If IsNull(rst![次数]) Then
int1 = 0
Else
int1 = Trim(rst![次数])
End If
If int1 <> 0 Then
CombCS.AddItem int1
End If
rst.MoveNext
Loop
CombCS.Text = CombCS.List(0)
rst.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -