📄 frmcarbflr.frm
字号:
Attribute VB_Exposed = False
'*************************************************************************
'**模 块 名:frmcarBFlr
'**版权说明:吉林省明日科技有限公司享有本软件的所有版权,如果本软件用于商
'** 业用途,必须经过吉林省明日科技有限公司授权。如果提供网上免费
'** 下载,必须经过吉林省明日科技有限公司授权,并保证程序的完整,
'** 不得修改代码、注释和相关内容,否则,我公司将追究其法律责任
'**网 址: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 Text3.SetFocus
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Imgexit_Click
End Sub
Private Sub Image1_Click() '修改
Unlockctl
Text1.Enabled = False
i = 2
Imgok.Enabled = True
Imgcancel.Enabled = True
Imgadd.Enabled = False
Imgdelete.Enabled = False
DTPicker1.Visible = True
Adodc1.Enabled = False
End Sub
Private Sub Image2_Click()
If MsgBox("您确实要删除记录吗?", vbOKCancel, "车辆管理系统") = vbOK Then
Call main1
adoCon.Execute ("delete from 车辆报废表 where 车牌号码='" & Text1 & "'")
MsgBox " 记录已删除!", , "车辆管理系统"
Adodc1.Refresh
adoCon.Close
'清空文本
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
End If
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
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
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(2)
Text2.Text = Adodc1.Recordset.Fields(1)
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 = "" Then
MsgBox "车牌号码不能为空", , "车辆管理系统"
Text1.SetFocus
Exit Sub
End If
If DTPicker1.Value = "" Then
MsgBox "报废日期不能为空", , "车辆管理系统"
DTPicker1.SetFocus
Exit Sub
End If
cnn.Execute ("insert into 车辆报废表 values ('" & Text1 & "','" & Text2 & "','" & DTPicker1.Value & "','" & 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
End If
MsgBox "记录添加成功!", , "车辆管理系统"
Adodc1.Refresh
Case 2
cnn.Execute ("update 车辆报废表 set 报废日期='" & DTPicker1.Value & "', 报废原因='" & Text2 & "',经手人='" & Text3 & "',备注='" & Text4 & "' where 车牌号码='" & Text1 & "'")
MsgBox "记录修改成功!", , "车辆管理系统"
Adodc1.Refresh
End Select
Lockctl
Imgok.Enabled = False
Imgcancel.Enabled = False
Imgadd.Visible = True
Imgupdate.Enabled = True
Imgdelete.Enabled = True
Adodc1.Enabled = True
End Sub
Private Sub Imgupdate_Click()
'设置控件状态
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
DTPicker1.Enabled = True
Text1.Enabled = False
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_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text1.Text = "" Then
MsgBox "车牌号码不能为空!", , "车辆管理系统"
Text1.SetFocus
Exit Sub
End If
Text2.SetFocus
End If
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
Dim rss1 As New ADODB.Recordset
Set rss1 = adoCon.Execute("select * from 车辆异动表 where 车牌号码='" & Text1.Text & "'")
If rss1.EOF Then
Else
MsgBox "该车为异动车辆,不能报废!", , "车辆管理系统"
Text1 = ""
Text1.SetFocus
End If
rss1.Close
Dim rs As New ADODB.Recordset
Set rs = adoCon.Execute("select * from 车辆报废表 where 车牌号码='" & Text1.Text & "'")
If rs.EOF = False Then
MsgBox "这辆车已经报废!", , "车辆管理系统"
Text1 = ""
End If
rss.Close
rs.Close
adoCon.Close
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then DTPicker1.SetFocus '按回车键DTPicker1获得焦点
End Sub
Private Sub text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text4.SetFocus '按回车键Text1获得焦点
End Sub
Private Sub DTPicker1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text3.SetFocus '按回车键Text3获得焦点
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
Private Sub Form_Load()
'自动识别路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\clgl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from 车辆报废表"
Adodc1.Refresh
'设置窗体大小
frmcarBFlr.Height = 2385
frmcarBFlr.Width = 6780
'设置控件状态
Imgupdate.Enabled = False
Imgdelete.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -