📄 frm_xxcx.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Frm_Xxcx
BorderStyle = 1 'Fixed Single
Caption = "信息查询"
ClientHeight = 4785
ClientLeft = 45
ClientTop = 330
ClientWidth = 7305
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 4785
ScaleWidth = 7305
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc1
Height = 345
Left = 225
Top = 4920
Width = 2820
_ExtentX = 4974
_ExtentY = 609
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
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 VB.Timer Timer1
Interval = 60
Left = 1545
Top = 4185
End
Begin MSDataGridLib.DataGrid Dgr_Cx
Bindings = "Frm_Xxcx.frx":0000
Height = 3645
Left = 75
TabIndex = 1
Top = 855
Width = 7155
_ExtentX = 12621
_ExtentY = 6429
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Caption = "查询条件"
Height = 765
Left = 60
TabIndex = 0
Top = 30
Width = 7185
Begin VB.CommandButton Cmd_exit
Caption = "关闭"
Height = 315
Left = 6180
TabIndex = 6
Top = 315
Width = 900
End
Begin VB.CommandButton Cmd_Cancel
Caption = "取消"
Height = 315
Left = 5205
TabIndex = 5
Top = 315
Width = 900
End
Begin VB.TextBox Txt_cx
Height = 300
Left = 2685
TabIndex = 4
Top = 330
Width = 2445
End
Begin VB.ComboBox Cbx_tj
Height = 300
Left = 210
Style = 2 'Dropdown List
TabIndex = 2
Top = 315
Width = 1830
End
Begin MSComCtl2.DTPicker DT1
Height = 300
Left = 2685
TabIndex = 8
Top = 330
Width = 2445
_ExtentX = 4313
_ExtentY = 529
_Version = 393216
Format = 19791873
CurrentDate = 38702
End
Begin VB.Label Label1
Caption = "Like"
Height = 225
Left = 2145
TabIndex = 3
Top = 360
Width = 525
End
End
Begin VB.Label Label2
Height = 240
Left = 4800
TabIndex = 7
Top = 4560
Width = 2340
End
End
Attribute VB_Name = "Frm_Xxcx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim Coms As String
Private Sub Cbx_tj_Change()
Coms = Adodc1.Recordset.Fields(Cbx_tj.ListIndex).Name
End Sub
Private Sub Cbx_tj_Click()
Coms = Adodc1.Recordset.Fields(Cbx_tj.ListIndex).Name
If Cbx_tj.Text = "任务时间" Or Cbx_tj.Text = "开票日期" Or Cbx_tj.Text = "出货日期" Or Cbx_tj.Text = "验收日期" Then
Txt_cx.Visible = False
DT1.Visible = True
Else
Txt_cx.Visible = True
DT1.Visible = False
End If
End Sub
Private Sub Cbx_tj_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Txt_cx.SetFocus
End If
End Sub
Private Sub Cmd_Cancel_Click()
Txt_cx.Text = ""
End Sub
Private Sub Cmd_exit_Click()
Unload Me
End Sub
Private Sub DT1_Change()
If Coms = "khys_ysrq" Then
Adodc1.RecordSource = "select * from tb_Goods_khys where " & Coms & " = '" + STR(DT1.Value) + "'"
Adodc1.Refresh
Call DgrTitle(4)
ElseIf Coms = "sqd_chrq" Then
Adodc1.RecordSource = "select * from tb_Goods_sqd where " & Coms & " = '" + STR(DT1.Value) + "'"
Adodc1.Refresh
Call DgrTitle(1)
ElseIf Coms = "sqd_kqrq" Then
Adodc1.RecordSource = "select * from tb_Goods_sqd where " & Coms & " = '" + STR(DT1.Value) + "'"
Adodc1.Refresh
Call DgrTitle(1)
ElseIf Coms = "cldd_rwsj" Then
Adodc1.RecordSource = "select * from tb_Goods_cldd where " & Coms & " = '" + STR(DT1.Value) + "'"
Adodc1.Refresh
Call DgrTitle(2)
End If
End Sub
Private Sub Form_Load()
AdoRs.Open "select * from tb_Goods_sqd", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
End If
AdoRs.Close
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
If StrCx = 1 Then
Call Flcx(1) '调用保存查询字符串的过程
ElseIf StrCx = 2 Then
Call Flcx(2)
ElseIf StrCx = 3 Then
Call Flcx(3)
ElseIf StrCx = 4 Then
Call Flcx(4)
End If
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = StrRs
Adodc1.Refresh
Set Dgr_Cx.DataSource = Adodc1
If StrCx = 1 Then
Call DgrTitle(1) '调用保存查询字符串的过程
For i = 0 To 23
Cbx_tj.AddItem Dgr_Cx.Columns(i).Caption
Next i
ElseIf StrCx = 2 Then
Call DgrTitle(2)
For i = 0 To 7
Cbx_tj.AddItem Dgr_Cx.Columns(i).Caption
Next i
ElseIf StrCx = 3 Then
Call DgrTitle(3)
For i = 0 To 23
Cbx_tj.AddItem Dgr_Cx.Columns(i).Caption
Next i
ElseIf StrCx = 4 Then
Call DgrTitle(4)
For i = 0 To 6
Cbx_tj.AddItem Dgr_Cx.Columns(i).Caption
Next i
End If
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Label2.Caption = "共查询到 " & Adodc1.Recordset.RecordCount & " 条记录"
End Sub
Private Sub Flcx(Nums As Integer)
Select Case Nums
Case 1 '货物申请查询
Me.Caption = "货物申请单查询"
StrRs = "select * from tb_Goods_sqd order by sqd_lszh"
Case 2
Me.Caption = "车辆调度查询"
StrRs = "select * from tb_Goods_cldd order by cldd_id"
Case 3
Me.Caption = "货物托运单查询"
StrRs = "select * from tb_Goods_tyd order by tyd_tydh"
Case 4
Me.Caption = "货物验收单查询"
StrRs = "select * from tb_Goods_khys order by khys_id"
End Select
End Sub
Private Sub DgrTitle(Nums As Integer)
Select Case Nums
Case 1
Dgr_Cx.Columns(0).Caption = "流水账号"
Dgr_Cx.Columns(1).Caption = "申请单号"
Dgr_Cx.Columns(2).Caption = "客户编号"
Dgr_Cx.Columns(3).Caption = "客户名称"
Dgr_Cx.Columns(4).Caption = "出货日期"
Dgr_Cx.Columns(5).Caption = "主件名称"
Dgr_Cx.Columns(6).Caption = "体积"
Dgr_Cx.Columns(7).Caption = "开票日期"
Dgr_Cx.Columns(8).Caption = "订单编号"
Dgr_Cx.Columns(9).Caption = "主件数量"
Dgr_Cx.Columns(10).Caption = "运费"
Dgr_Cx.Columns(11).Caption = "合同编号"
Dgr_Cx.Columns(12).Caption = "出发地点"
Dgr_Cx.Columns(13).Caption = "附件名称"
Dgr_Cx.Columns(14).Caption = "分送运费"
Dgr_Cx.Columns(15).Caption = "车辆编号"
Dgr_Cx.Columns(16).Caption = "目的地点"
Dgr_Cx.Columns(17).Caption = "附件数量"
Dgr_Cx.Columns(18).Caption = "合计金额"
Dgr_Cx.Columns(19).Caption = "车牌号码"
Dgr_Cx.Columns(20).Caption = "距离"
Dgr_Cx.Columns(21).Caption = "吨位"
Dgr_Cx.Columns(22).Caption = "发票号码"
Dgr_Cx.Columns(23).Caption = "所属部门"
Dgr_Cx.Columns(24).Caption = "备注"
Case 2
Dgr_Cx.Columns(0).Caption = "车辆调度编号"
Dgr_Cx.Columns(1).Caption = "车牌号码"
Dgr_Cx.Columns(2).Caption = "车主姓名"
Dgr_Cx.Columns(3).Caption = "司机姓名"
Dgr_Cx.Columns(4).Caption = "执行任务"
Dgr_Cx.Columns(5).Caption = "任务时间"
Dgr_Cx.Columns(6).Caption = "配送货物名称"
Dgr_Cx.Columns(7).Caption = "送货地点"
Dgr_Cx.Columns(8).Caption = "备注"
Case 3
Dgr_Cx.Columns(0).Caption = "托运单号"
Dgr_Cx.Columns(1).Caption = "申请单号"
Dgr_Cx.Columns(2).Caption = "客户名称"
Dgr_Cx.Columns(3).Caption = "托运货物"
Dgr_Cx.Columns(4).Caption = "客户电话"
Dgr_Cx.Columns(5).Caption = "客户联系人"
Dgr_Cx.Columns(6).Caption = "承运单位"
Dgr_Cx.Columns(7).Caption = "承运单位电话"
Dgr_Cx.Columns(8).Caption = "承运单位联系人"
Dgr_Cx.Columns(9).Caption = "收货单位"
Dgr_Cx.Columns(10).Caption = "收货单位电话"
Dgr_Cx.Columns(11).Caption = "收货单位联系人"
Dgr_Cx.Columns(12).Caption = "收货地址"
Dgr_Cx.Columns(13).Caption = "承运司机"
Dgr_Cx.Columns(14).Caption = "车牌号码"
Dgr_Cx.Columns(15).Caption = "车辆编号"
Dgr_Cx.Columns(16).Caption = "司机手机"
Dgr_Cx.Columns(17).Caption = "保险金额"
Dgr_Cx.Columns(18).Caption = "保险费"
Dgr_Cx.Columns(19).Caption = "运费"
Dgr_Cx.Columns(20).Caption = "付款方式"
Dgr_Cx.Columns(21).Caption = "已付费用"
Dgr_Cx.Columns(22).Caption = "费用合计"
Dgr_Cx.Columns(23).Caption = "是否验收"
Dgr_Cx.Columns(24).Caption = "备注"
Case 4
Dgr_Cx.Columns(0).Caption = "编号"
Dgr_Cx.Columns(1).Caption = "客户验收编号"
Dgr_Cx.Columns(2).Caption = "客户名称"
Dgr_Cx.Columns(3).Caption = "托运单号"
Dgr_Cx.Columns(4).Caption = "验收日期"
Dgr_Cx.Columns(5).Caption = "验收单位"
Dgr_Cx.Columns(6).Caption = "验收人"
Dgr_Cx.Columns(7).Caption = "备注"
End Select
End Sub
Private Sub DgrTitle2()
End Sub
Private Sub Txt_cx_Change()
If Cbx_tj.Text <> "" Then
If StrCx = 1 Then
Call FlcxChage(1) '调用查询过程
Call DgrTitle(1)
ElseIf StrCx = 2 Then
Call FlcxChage(2)
Call DgrTitle(2)
ElseIf StrCx = 3 Then
Call FlcxChage(3)
Call DgrTitle(3)
ElseIf StrCx = 4 Then
Call FlcxChage(4)
Call DgrTitle(4)
End If
End If
End Sub
Private Sub FlcxChage(Nums As Integer)
Select Case Nums
Case 1 '货物申请查询
Adodc1.RecordSource = "select * from tb_Goods_sqd where " & Coms & " Like '%" + Txt_cx.Text + "%'"
Adodc1.Refresh
Case 2
Adodc1.RecordSource = "select * from tb_Goods_cldd where " & Coms & " Like '%" + Txt_cx.Text + "%'"
Adodc1.Refresh
Case 3
Adodc1.RecordSource = "select * from tb_Goods_tyd where " & Coms & " Like '%" + Txt_cx.Text + "%'"
Adodc1.Refresh
Case 4
Adodc1.RecordSource = "select * from tb_Goods_khys where " & Coms & " Like '%" + Txt_cx.Text + "%'"
Adodc1.Refresh
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -