📄 frmcarbfcha.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmcarBFcha
Caption = "车辆报废查询"
ClientHeight = 3750
ClientLeft = 60
ClientTop = 345
ClientWidth = 5610
LinkTopic = "Form7"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 3750
ScaleWidth = 5610
Begin VB.CommandButton cmdExit
Caption = "退 出(&E)"
Height = 345
Left = 4245
TabIndex = 0
Top = 3315
Width = 1350
End
Begin VB.CommandButton cmdCha
Caption = "查 询(&F)"
Height = 345
Left = 2910
TabIndex = 11
Top = 3315
Width = 1350
End
Begin VB.Frame Frame1
Caption = " 查询条件"
ForeColor = &H00FF0000&
Height = 3180
Left = 30
TabIndex = 1
Top = 45
Width = 5520
Begin VB.CheckBox ckcp
Caption = "车牌号码:"
Height = 255
Left = 120
TabIndex = 8
Top = 360
Width = 1215
End
Begin VB.CheckBox cktime
Caption = "报废日期:"
Height = 180
Left = 120
TabIndex = 7
Top = 825
Width = 1215
End
Begin VB.CheckBox ckyy
Caption = "报废原因:"
Height = 255
Left = 120
TabIndex = 6
Top = 1260
Width = 1215
End
Begin VB.ComboBox cmcp
Enabled = 0 'False
Height = 300
Left = 1320
TabIndex = 5
Top = 315
Width = 4035
End
Begin VB.ComboBox cmyy
Enabled = 0 'False
Height = 300
Left = 1320
TabIndex = 4
Top = 1260
Width = 4035
End
Begin MSComCtl2.DTPicker dtEnd
Height = 300
Left = 3705
TabIndex = 2
Top = 780
Width = 1620
_ExtentX = 2858
_ExtentY = 529
_Version = 393216
Enabled = 0 'False
Format = 66191361
CurrentDate = 38053
End
Begin MSComCtl2.DTPicker dtStart
Height = 300
Left = 1560
TabIndex = 3
Top = 780
Width = 1620
_ExtentX = 2858
_ExtentY = 529
_Version = 393216
Enabled = 0 'False
Format = 66191361
CurrentDate = 38053
End
Begin MSAdodcLib.Adodc Adodc1
Height = 345
Left = 1050
Top = 2475
Visible = 0 'False
Width = 2325
_ExtentX = 4101
_ExtentY = 609
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
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 MSDataGridLib.DataGrid DataGrid1
Bindings = "frmcarBFcha.frx":0000
Height = 1215
Left = 90
TabIndex = 12
Top = 1890
Width = 5340
_ExtentX = 9419
_ExtentY = 2143
_Version = 393216
AllowUpdate = 0 'False
ForeColor = 4227072
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.Label Label1
Caption = "查询记录显示:"
ForeColor = &H00FF0000&
Height = 180
Left = 120
TabIndex = 13
Top = 1635
Width = 3735
End
Begin VB.Label Label6
Caption = "从"
ForeColor = &H00FF0000&
Height = 255
Left = 1320
TabIndex = 10
Top = 870
Width = 255
End
Begin VB.Label Label5
Caption = "到"
ForeColor = &H00FF0000&
Height = 255
Left = 3330
TabIndex = 9
Top = 870
Width = 255
End
End
End
Attribute VB_Name = "frmcarBFcha"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub ckcp_Click()
If ckcp.Value Then
cmCP.Enabled = True
Else
cmCP.Enabled = False
End If
End Sub
Private Sub cktime_Click()
If cktime.Value Then
dtStart.Enabled = True
dtEnd.Enabled = True
Else
dtStart.Enabled = False
dtEnd.Enabled = False
End If
End Sub
Private Sub ckyy_Click()
If ckyy.Value Then
cmyy.Enabled = True
Else
cmyy.Enabled = False
End If
End Sub
Private Sub cmdCha_Click()
'点击查询按纽后首先清空车辆报废列表
Call QingKong
'定义查询条件的字符串
Dim sql As String
Dim scp As String
If ckcp.Value Then
scp = "车牌号码 like '%" & cmCP.Text & "%'"
Else
scp = "车牌号码 like '%'"
End If
Dim stime As String
If cktime.Value Then
stime = "报废日期 between #" & dtStart.Month & "/" & dtStart.Day & "/" & dtStart.Year & "# and #" & dtEnd.Month & "/" & dtEnd.Day & "/" & dtEnd.Year & "#"
Else
stime = "报废日期 like '%'"
End If
Dim sdd As String
If ckyy.Value Then
syy = "报废原因 like'%" & cmyy.Text & "%'"
Else
syy = "报废原因 like '%'"
End If
sql = "select * from 车辆报废表 where " & scp & "and " & syy & "and " & stime
'如果没有选择查询条件,那么清空上一次查询结果并给出对话框提示,退出查询过程
If sql = "select * from 车辆报废表 where 车牌号码 like '%'and 报废原因 like '%'and 报废日期 like '%'" Then
Call QingKong
MsgBox "请选择查询条件", , "系统提示"
Exit Sub
End If
'返回符合查询条件的记录集
Set adors = adoCon.Execute(sql)
'如果记录集为空,说明没有符合条件的记录存在,清空上一次查询结果集并提示,
'退出此次查询过程,否则在datagrid1控件里显示记录集
If adors.EOF Then
Call QingKong
MsgBox "对不起,没有符合您查询条件的车辆!", , "系统提示"
Else
Adodc1.RecordSource = sql
Adodc1.Refresh
End If
adors.Close
ckcp.Value = 0
cktime.Value = 0
ckyy.Value = 0
End Sub
Private Sub cmdExit_Click()
MDIForm1.StatusBar1.Panels(1).Text = ""
Unload Me
End Sub
Private Sub Form_Load()
frmcarBFcha.Height = 4155
frmcarBFcha.Width = 5730
Label1.Caption = "车辆报废列表"
Call Rebind
'将车辆报废表里的车牌号码加到cmcp控件里
Set adors = adoCon.Execute("select distinct 车牌号码,报废原因 from 车辆报废表")
On Error Resume Next
Do
cmCP.AddItem adors.Fields(0)
cmyy.AddItem adors.Fields(1)
adors.MoveNext
Loop Until adors.EOF
End Sub
Private Sub Rebind()
Label1.Caption = "车辆报废列表"
'进行与数据库的绑定及选择作为记录源的表
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\clgl.mdb " & ";Persist Security Info=False"
Adodc1.RecordSource = "select * from 车辆报废表"
Adodc1.Refresh
End Sub
Private Sub QingKong()
Label1.Caption = "您所要查询的报废车辆记录如下:"
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\clgl.mdb " & ";Persist Security Info=False"
Adodc1.RecordSource = "select * from 车辆报废表 where 0=1"
Adodc1.Refresh
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
cmdExit_Click
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -