📄 frmcarwzlr.frm
字号:
Height = 330
Left = 1020
Picture = "frmcarWZlr.frx":212CB
Stretch = -1 'True
Top = 1935
Width = 900
End
Begin VB.Image Imgadd
Height = 330
Left = 120
Picture = "frmcarWZlr.frx":252E6
Stretch = -1 'True
Top = 1935
Width = 900
End
Begin VB.Image ImgFind
Height = 330
Left = 120
Picture = "frmcarWZlr.frx":292E4
Stretch = -1 'True
Top = 1605
Width = 900
End
End
Attribute VB_Name = "frmcarWZlr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*************************************************************************
'**模 块 名:frmcarWZlr
'**版权说明:吉林省明日科技有限公司享有本软件的所有版权,如果本软件用于商
'** 业用途,必须经过吉林省明日科技有限公司授权。如果提供网上免费
'** 下载,必须经过吉林省明日科技有限公司授权,并保证程序的完整,
'** 不得修改代码、注释和相关内容,否则,我公司将追究其法律责任
'**网 址:www.mingrisoft.com 价值无限,服务无限
'**电 话:(0431)84978981,84978982
'**创 建 人:明日科技
'**日 期:2007-10-31
'**修 改 人:mraj
'**日 期:2007-10-31
'**描 述:
'*************************************************************************
Dim i As Integer
Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Text4.SetFocus
End Sub
Private Sub Form_Load()
DTPicker1.Value = Date
frmcarWZlr.Width = 6720: frmcarWZlr.Height = 2775 '设置窗体大小
'自动识别路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\clgl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from 车辆违章表"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then DTPicker1.Value = Adodc1.Recordset.Fields("违章时间").Value
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Imgexit_Click
End Sub
Private Sub Image1_Click(Index As Integer)
On Error Resume Next
Select Case Index
Case 0
Adodc1.Recordset.MoveFirst
Case 1
If Adodc1.Recordset.BOF = False Then
Adodc1.Recordset.MovePrevious
Else
Adodc1.Recordset.MoveFirst
MsgBox "该记录为第一条记录!", , "车辆管理系统"
End If
Case 2
If Adodc1.Recordset.EOF = False Then
Adodc1.Recordset.MoveNext
Else
Adodc1.Recordset.MoveLast
MsgBox "该记录为最后一条记录!", , "车辆管理系统"
End If
Case 3
Adodc1.Recordset.MoveLast
End Select
Text1.Text = Adodc1.Recordset.Fields(0)
Text2.Text = Adodc1.Recordset.Fields(1)
Text3.Text = Adodc1.Recordset.Fields(2)
DTPicker1.Value = Adodc1.Recordset.Fields(3)
Text4.Text = Adodc1.Recordset.Fields(4)
End Sub
Private Sub Imgadd_Click() '增加
Adodc1.Recordset.AddNew
Unlockctl
Text1 = "": Text2 = ""
Text3 = "": Text4 = ""
DTPicker1.Value = Format(Now, "yyyy-mm-dd")
Text1.SetFocus
Imgok.Enabled = True: Imgcancel.Enabled = True
Imgupdate.Enabled = False: Imgdelete.Enabled = False
i = 1
Adodc1.Enabled = False
End Sub
Private Sub Imgcancel_Click() '取消
On Error Resume Next '当没有添加数据的时候 处理异常
Adodc1.Recordset.CancelUpdate
Adodc1.Refresh
Lockctl
Imgcancel.Enabled = False: Imgok.Enabled = False
Imgadd.Enabled = True: Imgupdate.Enabled = True
Imgdelete.Enabled = True: Adodc1.Enabled = True
End Sub
Private Sub Imgdelete_Click() '删除
If MsgBox("您确实要删除记录吗?", vbOKCancel, "车辆管理系统") = vbOK Then
Adodc1.Recordset.Delete
MsgBox "该记录已删除!", , "车辆管理系统"
Adodc1.Refresh
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End If
End Sub
Private Sub Imgexit_Click() '退出
On Error Resume Next
MDIForm1.StatusBar1.Panels(1).Text = ""
adors.Close
Unload Me
End Sub
Private Sub Imgfind_Click() '查询
Dim str As String
str = InputBox$("输入你要查询的查牌号码:", "车辆管理系统")
If str = "" Then Exit Sub
Adodc1.RecordSource = "select * from 车辆违章表 where 车牌号码='" + str + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
On Error Resume Next
Text1.Text = Adodc1.Recordset.Fields(0)
Text2.Text = Adodc1.Recordset.Fields(1)
Text3.Text = Adodc1.Recordset.Fields(2)
DTPicker1.Value = Adodc1.Recordset.Fields(3)
Text4.Text = Adodc1.Recordset.Fields(4)
Image1(0).Enabled = True
Image1(1).Enabled = True
Image1(2).Enabled = True
Image1(3).Enabled = True
Imgupdate.Enabled = True
Imgdelete.Enabled = True
Else
MsgBox "没有你需要的信息!", , "车辆管理系统"
Imgupdate.Enabled = False
Imgdelete.Enabled = False
End If
End Sub
Private Sub Imgok_Click() '确定
Select Case i
Case 1
If Text1 = "" Then
MsgBox "车牌号码不能为空", , "车辆管理系统"
Text1.SetFocus: Exit Sub
End If
If Text2 = "" Then
MsgBox "违章原因不能为空", , "车辆管理系统"
Text2.SetFocus: Exit Sub
End If
If DTPicker1.Value = "" Then
MsgBox "违章时间不能为空", , "车辆管理系统"
DTPicker1.SetFocus: Exit Sub
End If
Adodc1.Recordset.Fields(0) = Text1.Text
Adodc1.Recordset.Fields(1) = Text2.Text
Adodc1.Recordset.Fields(2) = Text3.Text
Adodc1.Recordset.Fields(3) = Format(DTPicker1.Value, "yyyy-mm-dd")
Adodc1.Recordset.Fields(4) = Text4.Text
Adodc1.Recordset.Update
MsgBox "记录添加成功!", , "车辆管理系统"
Case 2
On Error Resume Next
Adodc1.Recordset.Fields(0) = Text1.Text
Adodc1.Recordset.Fields(1) = Text2.Text
Adodc1.Recordset.Fields(2) = Text3.Text
Adodc1.Recordset.Fields(3) = Format(DTPicker1.Value, "yyyy-mm-dd")
Adodc1.Recordset.Fields(4) = Text4.Text
Adodc1.Recordset.Update
MsgBox "记录修改成功!", , "车辆管理系统"
End Select
Lockctl
Imgok.Enabled = False: Imgcancel.Enabled = False
Imgadd.Enabled = True: Imgupdate.Enabled = True
Imgdelete.Enabled = True: Adodc1.Enabled = True
Image1(0).Enabled = True: Image1(1).Enabled = True
Image1(2).Enabled = True: Image1(3).Enabled = True
End Sub
Private Sub Imgupdate_Click() '修改
Unlockctl
Text1.Enabled = False: Adodc1.Enabled = False
Imgok.Enabled = True: Imgcancel.Enabled = True
Imgadd.Enabled = False: Imgdelete.Enabled = False
i = 2
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text2.SetFocus
End Sub
Private Sub Text1_LostFocus()
If Text1.Text = "" Then Exit Sub
Dim rss As New ADODB.Recordset
Call main1
Set rss = adoCon.Execute("select * from 车辆档案 where 车牌号码='" & Text1.Text & "'")
If rss.EOF Then
MsgBox "这辆车不属于本公司的!", , "车辆管理系统"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
rss.Close
Dim rss1 As New ADODB.Recordset
Set rss1 = adoCon.Execute("select * from 车辆异动表 where 车牌号码='" & Text1.Text & "'")
If rss1.EOF Then
Else
MsgBox "该车为异动车辆!", , "车辆管理系统"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
rss1.Close
Dim rss2 As New ADODB.Recordset
Set rss2 = adoCon.Execute("select * from 车辆报废表 where 车牌号码='" & Text1.Text & "'")
If rss2.EOF Then
Else
MsgBox "该车已经报废!", , "车辆管理系统"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
rss2.Close
adoCon.Close
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text3.SetFocus '按回车键Text3获得焦点
End Sub
Private Sub text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then DTPicker1.SetFocus '按回车键DTPicker1获得焦点
End Sub
Private Sub DTPicker1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text4.SetFocus '按回车键Text4获得焦点
End Sub
Private Sub Lockctl()
Text1.Enabled = False: Text2.Enabled = False
Text3.Enabled = False: Text4.Enabled = False
DTPicker1.Enabled = False
End Sub
Private Sub Unlockctl()
Text1.Enabled = True: Text2.Enabled = True
Text3.Enabled = True: Text4.Enabled = True
DTPicker1.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -