📄 frmhuanji.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmhuanji
BackColor = &H80000018&
Caption = "换机信息查询!!!!"
ClientHeight = 4275
ClientLeft = 60
ClientTop = 450
ClientWidth = 10740
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 4275
ScaleWidth = 10740
WindowState = 2 'Maximized
Begin VB.Frame Frame2
BackColor = &H80000018&
Caption = "选时间段进行查询:"
Height = 615
Left = 120
TabIndex = 1
Top = 600
Width = 10455
Begin MSComCtl2.DTPicker DTPicker1
Height = 255
Left = 1680
TabIndex = 2
Top = 240
Width = 2175
_ExtentX = 3836
_ExtentY = 450
_Version = 393216
Format = 58982401
CurrentDate = 38150
End
Begin MSComCtl2.DTPicker DTPicker2
Height = 255
Left = 4560
TabIndex = 3
Top = 240
Width = 2175
_ExtentX = 3836
_ExtentY = 450
_Version = 393216
Format = 58982401
CurrentDate = 38150
End
Begin VB.Label Label2
BackColor = &H80000018&
Caption = "从:"
Height = 255
Left = 1320
TabIndex = 5
Top = 240
Width = 495
End
Begin VB.Label Label3
BackColor = &H80000018&
Caption = "到"
Height = 255
Left = 4080
TabIndex = 4
Top = 240
Width = 375
End
Begin VB.Image Image4
Height = 330
Left = 7320
Picture = "frmhuanji.frx":0000
Top = 240
Width = 750
End
End
Begin VB.Frame Frame3
BackColor = &H80000018&
Caption = "信息处理:"
Height = 855
Left = 120
TabIndex = 0
Top = 1320
Width = 10455
Begin VB.Image Image1
Height = 330
Left = 240
Picture = "frmhuanji.frx":2DBD
Top = 360
Width = 750
End
Begin VB.Image Image2
Height = 330
Left = 1800
Picture = "frmhuanji.frx":5BBC
Top = 360
Width = 750
End
Begin VB.Image Image3
Height = 330
Left = 3720
Picture = "frmhuanji.frx":8967
Top = 360
Width = 750
End
End
End
Attribute VB_Name = "frmhuanji"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Label1_Click()
End Sub
Private Sub Form_Resize()
Frame3.Width = Me.Width - 500
Frame2.Width = Me.Width - 500
DTPicker1.Value = Date
DTPicker2.Value = Date
End Sub
Private Sub Image1_Click()
On Error Resume Next
Dim i As Integer
Call zdf
If CDate(DTPicker1.Value) = CDate(DTPicker2.Value) Then
rs.Open "select * from info where 维修方法='换机' and cdate(收机时间)='" & CDate(DTPicker1.Value) & "'"
i = rs.RecordCount
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks().Add
Set xlSheet = xlBook.Worksheets("sheet1")
xlSheet.Cells(1, 4) = DTPicker1.Value & "换机信息"
xlSheet.Cells(2, 1) = "受理修序号"
xlSheet.Cells(2, 2) = "机型"
xlSheet.Cells(2, 3) = "颜色"
xlSheet.Cells(2, 4) = "IMEI"
xlSheet.Cells(2, 5) = "此机属于"
xlSheet.Cells(2, 6) = "维修方法"
xlSheet.Cells(2, 7) = "故障描述"
xlSheet.Cells(2, 8) = "接收人员"
xlSheet.Cells(2, 9) = "收机时间"
Do While Not rs.EOF
For i = 3 To i + 3
xlSheet.Cells(i, 1) = rs.Fields(1).Value
xlSheet.Cells(i, 2) = rs.Fields(2).Value
xlSheet.Cells(i, 3) = rs.Fields(3).Value
xlSheet.Cells(i, 4) = rs.Fields(4).Value
xlSheet.Cells(i, 5) = rs.Fields(5).Value
xlSheet.Cells(i, 6) = rs.Fields(6).Value
xlSheet.Cells(i, 7) = rs.Fields(7).Value
xlSheet.Cells(i, 8) = rs.Fields(8).Value
xlSheet.Cells(i, 9) = rs.Fields(9).Value
rs.MoveNext
Next i
Loop
xlApp.Visible = True
xlApp.Application.Visible = True
Set xlApp = Nothing
Set xlBook = Nothing
Set xlSheet = Nothing
End If
If CDate(DTPicker1.Value) > CDate(DTPicker2.Value) Then
rs.Open "select * from info where 维修方法='换机' and cdate(收机时间) between '" & CDate(DTPicker2.Value) & "' and '" & CDate(DTPicker1.Value) & "'"
i = rs.RecordCount
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks().Add
Set xlSheet = xlBook.Worksheets("sheet1")
xlSheet.Cells(1, 4) = "从" & DTPicker2.Value & "到" & DTPicker1.Value & "换机信息"
xlSheet.Cells(2, 1) = "受理修序号"
xlSheet.Cells(2, 2) = "机型"
xlSheet.Cells(2, 3) = "颜色"
xlSheet.Cells(2, 4) = "IMEI"
xlSheet.Cells(2, 5) = "此机属于"
xlSheet.Cells(2, 6) = "维修方法"
xlSheet.Cells(2, 7) = "故障描述"
xlSheet.Cells(2, 8) = "接收人员"
xlSheet.Cells(2, 9) = "收机时间"
Do While Not rs.EOF
For i = 3 To i + 3
xlSheet.Cells(i, 1) = rs.Fields(1).Value
xlSheet.Cells(i, 2) = rs.Fields(2).Value
xlSheet.Cells(i, 3) = rs.Fields(3).Value
xlSheet.Cells(i, 4) = rs.Fields(4).Value
xlSheet.Cells(i, 5) = rs.Fields(5).Value
xlSheet.Cells(i, 6) = rs.Fields(6).Value
xlSheet.Cells(i, 7) = rs.Fields(7).Value
xlSheet.Cells(i, 8) = rs.Fields(8).Value
xlSheet.Cells(i, 9) = rs.Fields(9).Value
rs.MoveNext
Next i
Loop
xlApp.Visible = True
xlApp.Application.Visible = True
Set xlApp = Nothing
Set xlBook = Nothing
Set xlSheet = Nothing
End If
If CDate(DTPicker1.Value) < CDate(DTPicker2.Value) Then
rs.Open "select * from info where 维修方法='换机' and cdate(收机时间) between '" & CDate(DTPicker1.Value) & "' and '" & CDate(DTPicker2.Value) & "'"
i = rs.RecordCount
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks().Add
Set xlSheet = xlBook.Worksheets("sheet1")
xlSheet.Cells(1, 4) = "从" & DTPicker1.Value & "到" & DTPicker2.Value & "换机信息"
xlSheet.Cells(2, 1) = "受理修序号"
xlSheet.Cells(2, 2) = "机型"
xlSheet.Cells(2, 3) = "颜色"
xlSheet.Cells(2, 4) = "IMEI"
xlSheet.Cells(2, 5) = "此机属于"
xlSheet.Cells(2, 6) = "维修方法"
xlSheet.Cells(2, 7) = "故障描述"
xlSheet.Cells(2, 8) = "接收人员"
xlSheet.Cells(2, 9) = "收机时间"
Do While Not rs.EOF
For i = 3 To i + 3
xlSheet.Cells(i, 1) = rs.Fields(1).Value
xlSheet.Cells(i, 2) = rs.Fields(2).Value
xlSheet.Cells(i, 3) = rs.Fields(3).Value
xlSheet.Cells(i, 4) = rs.Fields(4).Value
xlSheet.Cells(i, 5) = rs.Fields(5).Value
xlSheet.Cells(i, 6) = rs.Fields(6).Value
xlSheet.Cells(i, 7) = rs.Fields(7).Value
xlSheet.Cells(i, 8) = rs.Fields(8).Value
xlSheet.Cells(i, 9) = rs.Fields(9).Value
rs.MoveNext
Next i
Loop
xlApp.Visible = True
xlApp.Application.Visible = True
Set xlApp = Nothing
Set xlBook = Nothing
Set xlSheet = Nothing
End If
End Sub
Private Sub Image2_Click()
On Error Resume Next
Call zdf
If CDate(DTPicker1.Value) = CDate(DTPicker2.Value) Then
rs.Open "select * from info where 维修方法='换机' and cdate(收机时间)='" & CDate(DTPicker1.Value) & "'"
With DataReport1
.Caption = DTPicker1.Value & "换机手机一览表"
Set .DataSource = rs
.Sections("Section1").Controls("text1").DataField = "受理修序号"
.Sections("Section1").Controls("text2").DataField = "机型"
.Sections("Section1").Controls("text3").DataField = "颜色"
.Sections("Section1").Controls("text4").DataField = "IMEI"
.Sections("Section1").Controls("text5").DataField = "此机属于"
.Sections("Section1").Controls("text6").DataField = "维修方法"
.Sections("Section1").Controls("text7").DataField = "故障描述"
.Sections("Section1").Controls("text8").DataField = "接收人员"
.Sections("Section1").Controls("text9").DataField = "收机时间"
.Sections("Section2").Controls("label15").Caption = DTPicker1.Value & "换机手机报表"
.Show
End With
End If
If CDate(DTPicker1.Value) > CDate(DTPicker2.Value) Then
rs.Open "select * from info where 维修方法='换机' and cdate(收机时间) between '" & CDate(DTPicker2.Value) & "' and '" & CDate(DTPicker1.Value) & "'"
With DataReport1
.Caption = "换机信息报表"
Set .DataSource = rs
.Sections("Section1").Controls("text1").DataField = "受理修序号"
.Sections("Section1").Controls("text2").DataField = "机型"
.Sections("Section1").Controls("text3").DataField = "颜色"
.Sections("Section1").Controls("text4").DataField = "IMEI"
.Sections("Section1").Controls("text5").DataField = "此机属于"
.Sections("Section1").Controls("text6").DataField = "维修方法"
.Sections("Section1").Controls("text7").DataField = "故障描述"
.Sections("Section1").Controls("text8").DataField = "接收人员"
.Sections("Section1").Controls("text9").DataField = "收机时间"
.Sections("Section2").Controls("label15").Caption = "从" & DTPicker2.Value & "到" & DTPicker1.Value & "换机手机报表"
.Show
End With
End If
If CDate(DTPicker1.Value) < CDate(DTPicker2.Value) Then
rs.Open "select * from info where 维修方法='换机' and cdate(收机时间) between '" & CDate(DTPicker1.Value) & "' and '" & CDate(DTPicker2.Value) & "'"
With DataReport1
.Caption = "换机信息报表"
Set .DataSource = rs
.Sections("Section1").Controls("text1").DataField = "受理修序号"
.Sections("Section1").Controls("text2").DataField = "机型"
.Sections("Section1").Controls("text3").DataField = "颜色"
.Sections("Section1").Controls("text4").DataField = "IMEI"
.Sections("Section1").Controls("text5").DataField = "此机属于"
.Sections("Section1").Controls("text6").DataField = "维修方法"
.Sections("Section1").Controls("text7").DataField = "故障描述"
.Sections("Section1").Controls("text8").DataField = "接收人员"
.Sections("Section1").Controls("text9").DataField = "收机时间"
.Sections("Section2").Controls("label15").Caption = "从" & DTPicker1.Value & "到" & DTPicker2.Value & "换机手机报表"
.Show
End With
End If
End Sub
Private Sub Image3_Click()
Unload Me
End Sub
Private Sub Image4_Click()
On Error Resume Next
Call zdf
If CDate(DTPicker1.Value) = CDate(DTPicker2.Value) Then
rs.Open "select count(*) from info where 维修方法='换机' and cdate(收机时间)='" & CDate(DTPicker1.Value) & "'"
MsgBox "共找到" & rs.Fields(0).Value & "条信息", vbOKOnly, "东信手机提醒你!!!"
End If
If CDate(DTPicker1.Value) > CDate(DTPicker2.Value) Then
rs.Open "select count(*) from info where 维修方法='换机' and cdate(收机时间) between '" & CDate(DTPicker2.Value) & "' and '" & CDate(DTPicker1.Value) & "'"
MsgBox "共找到" & rs.Fields(0).Value & "条信息", vbOKOnly, "东信手机提醒你!!!"
End If
If CDate(DTPicker1.Value) < CDate(DTPicker2.Value) Then
rs.Open "select count(*) from info where 维修方法='换机' and cdate(收机时间) between '" & CDate(DTPicker1.Value) & "' and '" & CDate(DTPicker2.Value) & "'"
MsgBox "共找到" & rs.Fields(0).Value & "条信息", vbOKOnly, "东信手机提醒你!!!"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -