📄 frmcarwxlr.frm
字号:
Stretch = -1 'True
Top = 2010
Width = 1050
End
Begin VB.Image Imgfind
Height = 330
Left = 3225
Picture = "frmcarWXlr.frx":25292
Stretch = -1 'True
Top = 2010
Width = 1050
End
Begin VB.Image Imgdelete
Height = 330
Left = 2175
Picture = "frmcarWXlr.frx":2929A
Stretch = -1 'True
Top = 2010
Width = 1050
End
Begin VB.Image Imgupdate
Height = 330
Left = 1125
Picture = "frmcarWXlr.frx":2D2A9
Stretch = -1 'True
Top = 2010
Width = 1050
End
End
Attribute VB_Name = "frmcarWXlr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*************************************************************************
'**模 块 名:frmcarWXlr
'**版权说明:吉林省明日科技有限公司享有本软件的所有版权,如果本软件用于商
'** 业用途,必须经过吉林省明日科技有限公司授权。如果提供网上免费
'** 下载,必须经过吉林省明日科技有限公司授权,并保证程序的完整,
'** 不得修改代码、注释和相关内容,否则,我公司将追究其法律责任
'**网 址:www.mingrisoft.com 价值无限,服务无限
'**电 话:(0431)84978981,84978982
'**创 建 人:明日科技
'**日 期:2007-10-31
'**修 改 人:mraj
'**日 期:2007-10-31
'**描 述:
'*************************************************************************
Dim i As Integer
Private Sub Combo1_KeyPress(KeyAscii As Integer)
KeyAscii = valiText(KeyAscii, Chr(13), True) '调用模块中的自定义函数
End Sub
Private Sub Combo2_KeyPress(KeyAscii As Integer)
KeyAscii = valiText(KeyAscii, Chr(13), True)
End Sub
Private Sub Combo3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Tc3.SetFocus
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Tc1.SetFocus
End Sub
Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Tc2.SetFocus
End Sub
Private Sub Combo3_KeyPress(KeyAscii As Integer)
KeyAscii = valiText(KeyAscii, Chr(13), True)
End Sub
Private Sub Form_Load()
'设置窗体大小
frmcarWXlr.Width = 8490
frmcarWXlr.Height = 3195
'自动识别路径
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
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\clgl.mdb;Persist Security Info=False"
Adodc2.RecordSource = "select * from 零件表"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
For i = 0 To Adodc2.Recordset.RecordCount - 1
If Adodc2.Recordset.Fields(0).Value <> "" Then
Combo1.AddItem Adodc2.Recordset.Fields(0).Value '向ComboBox控件中添加数据项
Combo2.AddItem Adodc2.Recordset.Fields(0).Value '向ComboBox控件中添加数据项
Combo3.AddItem Adodc2.Recordset.Fields(0).Value '向ComboBox控件中添加数据项
End If
Adodc2.Recordset.MoveNext
Next
End If
If Adodc1.Recordset.RecordCount = 0 Then Exit Sub
On Error Resume Next
Text1.Text = Adodc1.Recordset.Fields("车牌号码")
Combo1.Text = Adodc1.Recordset.Fields("更换零件1")
Tc1.Text = Adodc1.Recordset.Fields("零件1数量")
Combo2.Text = Adodc1.Recordset.Fields("更换零件2")
Tc2.Text = Adodc1.Recordset.Fields("零件2数量")
Combo3.Text = Adodc1.Recordset.Fields("更换零件3")
Tc3.Text = Adodc1.Recordset.Fields("零件3数量")
DTPicker1.Value = Adodc1.Recordset.Fields("维修日期")
Text5.Text = Adodc1.Recordset.Fields("共计费用")
Text6.Text = Adodc1.Recordset.Fields("备注")
ImgT.Enabled = False
End Sub
Private Sub Lockctl()
Text1.Enabled = False: Combo1.Enabled = False
Combo2.Enabled = False: Combo3.Enabled = False
Tc1.Enabled = False: Tc2.Enabled = False
Text5.Enabled = False: Text6.Enabled = False
DTPicker1.Enabled = False: Tc3.Enabled = False
End Sub
Private Sub Unlockctl()
Text1.Enabled = True: Combo1.Enabled = True
Combo2.Enabled = True: Combo3.Enabled = True
Tc1.Enabled = True: Tc2.Enabled = True
Tc3.Enabled = True: Text6.Enabled = True
DTPicker1.Enabled = True
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
MsgBox "向前已经没有记录了!", , "车辆管理系统"
End If
Case 2
If Adodc1.Recordset.EOF = False Then
Adodc1.Recordset.MoveNext
Else
MsgBox "向后已经没有记录了!", , "车辆管理系统"
End If
Case 3
Adodc1.Recordset.MoveLast
End Select
Text1.Text = Adodc1.Recordset.Fields(0)
Combo1.Text = Adodc1.Recordset.Fields(1)
Tc1.Text = Adodc1.Recordset.Fields(2)
Combo2.Text = Adodc1.Recordset.Fields(3)
Tc2.Text = Adodc1.Recordset.Fields(4)
Combo3.Text = Adodc1.Recordset.Fields(5)
Tc3.Text = Adodc1.Recordset.Fields(6)
DTPicker1.Value = Adodc1.Recordset.Fields(7)
Text5.Text = Adodc1.Recordset.Fields(8)
Text6.Text = Adodc1.Recordset.Fields(9)
End Sub
Private Sub Imgadd_Click() '增加
Unlockctl
DTPicker1.Value = Format(Now, "yyyy-mm-dd")
Text1 = "": Tc1 = ""
Tc2 = "": Tc3 = ""
Text5 = "": Text6 = ""
TextDTP = "": Combo1.Text = ""
Combo2.Text = "": Combo3.Text = ""
Text1.SetFocus
Imgok.Enabled = False: Imgcancel.Enabled = True
Imgupdate.Enabled = False: Imgdelete.Enabled = False
Combo1.Visible = True: Adodc1.Enabled = False
ImgT.Enabled = True
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
ImgT.Enabled = False
End Sub
Private Sub Imgdelete_Click() '删除
If MsgBox("您确实要删除记录吗?", vbOKCancel, "车辆管理系统") = vbOK Then
On Error Resume Next
Adodc1.Recordset.Delete
MsgBox " 记录已删除!", , "车辆管理系统"
Adodc1.Refresh
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)
Combo1.Text = Adodc1.Recordset.Fields(1)
Tc1.Text = Adodc1.Recordset.Fields(2)
Combo2.Text = Adodc1.Recordset.Fields(3)
Tc2.Text = Adodc1.Recordset.Fields(4)
Combo3.Text = Adodc1.Recordset.Fields(5)
Tc3.Text = Adodc1.Recordset.Fields(6)
DTPicker1.Value = Adodc1.Recordset.Fields(7)
Text5.Text = Adodc1.Recordset.Fields(8)
Text6.Text = Adodc1.Recordset.Fields(9)
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
Call main1
adoCon.Execute ("insert into 车辆维修表 values ('" & Text1 & "','" & Combo1.Text & "','" & Tc1.Text & "','" & Combo2.Text & "','" & Tc2.Text & "','" & Combo3.Text & "','" & Tc3.Text & "','" & DTPicker1.Value & "','" & Text5.Text & "','" & Text6.Text & "')")
MsgBox "记录添加成功!", , "车辆管理系统"
Adodc1.Refresh
Adodc1.Recordset.MoveLast
adoCon.Close
Case 2
Dim rs1 As New ADODB.Recordset
Call main1
rs1.Open "select * from 车辆维修表 where 车牌号码 ='" + Text1.Text + "'", adoCon, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
rs1.Fields(1) = Combo1.Text
rs1.Fields(2) = Tc1.Text
rs1.Fields(3) = Combo2.Text
rs1.Fields(4) = Tc2.Text
rs1.Fields(5) = Combo3.Text
rs1.Fields(6) = Tc3.Text
rs1.Fields(7) = DTPicker1.Value
rs1.Fields(8) = Text5.Text
rs1.Fields(9) = Text6.Text
rs1.Update
rs1.Close
MsgBox "记录修改成功!", , "车辆管理系统"
Adodc1.Refresh
End If
End Select
Lockctl
Imgok.Enabled = False: Imgcancel.Enabled = False
Imgadd.Enabled = True: Imgupdate.Enabled = True
Imgdelete.Enabled = True: Adodc1.Enabled = True
ImgT.Enabled = False
End Sub
Private Sub ImgT_Click() '统计
Dim c1, c2, c3 As Integer
On Error Resume Next
Adodc2.RecordSource = "select 单价 from 零件表 where 零件名='" & Combo1.Text & "'"
Adodc2.Refresh
c1 = Val(Adodc2.Recordset.Fields(0)) * Val(Tc1.Text)
Adodc2.RecordSource = "select 单价 from 零件表 where 零件名='" & Combo2.Text & "'"
Adodc2.Refresh
c2 = Val(Adodc2.Recordset.Fields(0)) * Val(Tc2.Text)
Adodc2.RecordSource = "select 单价 from 零件表 where 零件名='" & Combo3.Text & "'"
Adodc2.Refresh
c3 = Val(Adodc2.Recordset.Fields(0)) * Val(Tc3.Text)
Text5.Text = c1 + c2 + c3
Imgok.Enabled = True
End Sub
Private Sub Imgupdate_Click() '查询
Unlockctl
i = 2
Imgok.Enabled = True: Imgcancel.Enabled = True
Imgadd.Enabled = False: Imgdelete.Enabled = False
Adodc1.Enabled = False: Text1.Enabled = False
ImgT.Enabled = True
End Sub
Private Sub Tc1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Tc1.Text = "" Then
If Combo1.Text <> "" Then
MsgBox "请添加零件数量", , "车辆管理系统"
Exit Sub
End If
End If
Combo2.SetFocus
End If
End Sub
Private Sub Tc1_KeyPress(KeyAscii As Integer)
KeyAscii = valiText(KeyAscii, "0123456789." & Chr(8), True) '调用模块中的自定义函数
End Sub
Private Sub Tc2_KeyPress(KeyAscii As Integer)
KeyAscii = valiText(KeyAscii, "0123456789" & Chr(8), True)
End Sub
Private Sub Tc3_KeyPress(KeyAscii As Integer)
KeyAscii = valiText(KeyAscii, "0123456789." & Chr(8), True)
End Sub
Private Sub Tc2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Tc2.Text = "" Then
If Combo2.Text <> "" Then
MsgBox "请添加零件数量", , "车辆管理系统"
Exit Sub
End If
End If
Combo3.SetFocus
End If
End Sub
Private Sub Tc3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Tc3.Text = "" Then
If Combo3.Text <> "" Then
MsgBox "请添加零件数量", , "车辆管理系统"
Exit Sub
End If
End If
End If
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
Combo1.SetFocus
End If
End Sub
Private Sub Text1_LostFocus()
If Text1.Text = "" Then Exit Sub
Dim rss As New ADODB.Recordset
Call main1
rss.Open "select * from 车辆档案 where 车牌号码 ='" + Text1.Text + "'", adoCon, adOpenKeyset, adLockOptimistic
If rss.EOF Then
MsgBox "这辆车不属于本公司的!", , "车辆管理系统"
Text1.Text = ""
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 TextDTP_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text6.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -