📄 frmcarydlr.frm
字号:
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*************************************************************************
'**模 块 名:frmcarydlr
'**版权说明:吉林省明日科技有限公司享有本软件的所有版权,如果本软件用于商
'** 业用途,必须经过吉林省明日科技有限公司授权。如果提供网上免费
'** 下载,必须经过吉林省明日科技有限公司授权,并保证程序的完整,
'** 不得修改代码、注释和相关内容,否则,我公司将追究其法律责任
'**网 址:www.mingrisoft.com 价值无限,服务无限
'**电 话:(0431)84978981,84978982
'**创 建 人:明日科技
'**日 期:2007-10-31
'**修 改 人:mraj
'**日 期:2007-10-31
'**描 述:
'*************************************************************************
Dim i As Integer
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
Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text2.SetFocus
End Sub
Private Sub Form_Load()
'设置窗体大小
frmcarydlr.Height = 2415
frmcarydlr.Width = 6765
'设置控件大小
Imgupdate.Enabled = False
Imgdelete.Enabled = False
'自动识别路径
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 Imgadd_Click() '添加
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
DTPicker1.Visible = True
Adodc1.Enabled = False
i = 1
End Sub
Private Sub Imgcancel_Click() '取消
On Error Resume Next '当没有添加数据的时候 处理异常
Adodc1.Recordset.CancelUpdate
Adodc1.Refresh
Lockctl
Imgok.Enabled = False
Imgcancel.Enabled = False
Imgadd.Enabled = True
Imgupdate.Enabled = True
Imgdelete.Enabled = True
DTPicker1.Visible = True
Adodc1.Enabled = True
End Sub
Private Sub Imgdelete_Click() '删除
If MsgBox("您确实要删除记录吗?", vbOKCancel, "车辆管理系统") = vbOK Then
cnn.Execute ("delete from 车辆异动表 where 车牌号码='" & Text1 & "'")
Dim rs1 As New ADODB.Recordset
rs1.Open "select * from 车辆档案 where 车牌号码 ='" + Text1.Text + "'", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
rs1.Fields("异动否") = "否"
rs1.Update
End If
MsgBox " 记录已删除!", , "车辆管理系统"
Adodc1.Refresh
Adodc1.RecordSource = "select * from 车辆异动表"
Adodc1.Refresh
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
End If
End Sub
Private Sub Imgexit_Click() '退出
MDIForm1.StatusBar1.Panels(1).Text = ""
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
Text1.Text = Adodc1.Recordset.Fields(0)
DTPicker1.Value = Adodc1.Recordset.Fields(1)
Text2.Text = Adodc1.Recordset.Fields(2)
Text3.Text = Adodc1.Recordset.Fields(3)
Text4.Text = Adodc1.Recordset.Fields(4)
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.Text = "" Then
MsgBox "车牌号码不能为空!", , "车辆管理系统"
Exit Sub
End If
cnn.Execute ("insert into 车辆异动表 values ('" & Text1 & "','" & DTPicker1.Value & "','" & Text2 & "','" & Text3 & "','" & Text4 & "')")
Dim rs1 As New ADODB.Recordset
rs1.Open "select * from 车辆档案 where 车牌号码 ='" + Text1.Text + "'", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
rs1.Fields("异动否") = "是"
rs1.Update
rs1.Close
End If
MsgBox "记录添加成功!", , "车辆管理系统"
Adodc1.Refresh
Case 2
cnn.Execute ("update 车辆异动表 set 车牌号码='" & Text1.Text & "', 异动地点='" & Text2 & "',经手人='" & Text3 & "',备注='" & Text4 & "' where 车牌号码='" & Text1.Text & "'")
MsgBox "记录修改成功!", , "车辆管理系统"
Adodc1.Refresh
End Select
Lockctl
'设置控件状态
Imgok.Enabled = False
Imgcancel.Enabled = False
Imgadd.Enabled = True
Imgupdate.Enabled = True
Imgdelete.Enabled = True
DTPicker1.Visible = True
Adodc1.Enabled = True
End Sub
Private Sub Imgupdate_Click() '修改
Text1.Enabled = False
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
DTPicker1.Enabled = True
i = 2
Imgok.Enabled = True
Imgcancel.Enabled = True
Imgadd.Enabled = False
Imgdelete.Enabled = False
DTPicker1.Visible = True
Adodc1.Enabled = False
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Text1.Text = "" Then
MsgBox "车牌号码不能为空!!", , "车辆管理系统"
Text1.SetFocus
Exit Sub
End If
DTPicker1.SetFocus
End If
End Sub
Private Sub Text1_LostFocus()
If Text1.Text = "" Then Exit Sub
Dim rss As New ADODB.Recordset '定义数据集对象
Dim rss1 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
Dim rss2 As New ADODB.Recordset
Call main1
Set rss2 = adoCon.Execute("select * from 车辆报废表 where 车牌号码='" & Text1.Text & "'")
If rss2.EOF Then
Else
MsgBox "该车已经报废了,不能异动!", , ""
Text1 = ""
Text1.SetFocus
End If
rss2.Close
Set rss1 = adoCon.Execute("select * from 车辆异动表 where 车牌号码='" & Text1.Text & "'")
If rss1.EOF Then
Else
MsgBox "此车已经添加完异动信息了!", , "车辆管理系统"
Text1.Text = ""
Text1.SetFocus
End If
rss.Close
adoCon.Close
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Text2.Text = "" Then
MsgBox "异动地点不能为空!!", , "车辆管理系统"
Text2.SetFocus
Exit Sub
End If
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text4.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -