📄 frmrepair.frm
字号:
VERSION 5.00
Begin VB.Form frmrepair
BorderStyle = 1 'Fixed Single
Caption = "维修信息"
ClientHeight = 5190
ClientLeft = 3465
ClientTop = 2025
ClientWidth = 8325
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5190
ScaleWidth = 8325
Begin VB.CommandButton cmdcancel
Caption = "取 消"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6000
TabIndex = 16
Top = 4560
Width = 1455
End
Begin VB.CommandButton cmdok
Caption = "确 定"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3960
TabIndex = 15
Top = 4560
Width = 1575
End
Begin VB.Frame Frame1
Caption = "车辆维修信息"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4215
Left = 120
TabIndex = 0
Top = 240
Width = 8055
Begin VB.TextBox txtitem
Height = 975
Index = 5
Left = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 14
Top = 3000
Width = 7455
End
Begin VB.TextBox txtitem
Height = 375
Index = 4
Left = 5400
TabIndex = 13
Top = 1920
Width = 2175
End
Begin VB.TextBox txtitem
Height = 375
Index = 3
Left = 1680
TabIndex = 12
Top = 1920
Width = 2295
End
Begin VB.TextBox txtitem
Height = 615
Index = 2
Left = 5400
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 11
Top = 1080
Width = 2175
End
Begin VB.TextBox txtitem
Height = 615
Index = 1
Left = 1680
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 10
Top = 1080
Width = 2295
End
Begin VB.TextBox txtitem
Height = 270
Index = 0
Left = 5400
TabIndex = 9
Top = 480
Width = 2175
End
Begin VB.ComboBox cobid
Height = 300
Left = 1680
TabIndex = 2
Top = 480
Width = 2295
End
Begin VB.Label Label7
Caption = "备注:"
Height = 255
Left = 240
TabIndex = 8
Top = 2640
Width = 615
End
Begin VB.Label Label6
Caption = "维修配件:"
Height = 255
Left = 4320
TabIndex = 7
Top = 1920
Width = 975
End
Begin VB.Label Label5
Caption = "维修价格(元):"
Height = 255
Left = 240
TabIndex = 6
Top = 1920
Width = 1575
End
Begin VB.Label Label4
Caption = "维修内容:"
Height = 255
Left = 4320
TabIndex = 5
Top = 1080
Width = 975
End
Begin VB.Label Label3
Caption = "维修部门:"
Height = 255
Left = 240
TabIndex = 4
Top = 1080
Width = 975
End
Begin VB.Label Label2
Caption = "维修日期:"
Height = 255
Left = 4320
TabIndex = 3
Top = 480
Width = 1095
End
Begin VB.Label Label1
Caption = "车辆牌照:"
Height = 255
Left = 240
TabIndex = 1
Top = 480
Width = 1095
End
End
End
Attribute VB_Name = "frmrepair"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim txtchange As Boolean
Dim mrc As ADODB.Recordset
Public txtsql As String
Private Sub cmdcancel_Click()
If gintrMode = 2 Then
If txtchange And CmdOK.Enabled Then
If MsgBox("信息已经修改,是否保存修改的信息", vbOKCancel + vbExclamation, "提示") = vbOK Then
Call cmdok_Click
End If
End If
End If
Unload Me
End Sub
Private Sub cmdok_Click()
Dim txtcount As Integer
Dim tmsg As String
Dim msgtext As String
If cobid.Text = "" Then
MsgBox "车辆牌照不能为空,请选择车辆牌照", vbOKOnly + vbExclamation, "警告"
cobid.SetFocus
Exit Sub
End If
If Trim(txtitem(0) & "") = "" Then
MsgBox "修理日期不能为空!", vbOKOnly + vbExclamation, "警告"
Else
If Not IsDate(txtitem(0)) Then
MsgBox "请输入时间:yyyy-mm-dd", vbOKOnly + vbExclamation, "警告"
txtitem(0).SetFocus
Exit Sub
Else
txtitem(0) = Format(txtitem(0), "yyyy-mm-dd")
End If
End If
If Not IsNumeric(txtitem(3)) Then
MsgBox "请输入数字!", vbOKOnly + vbExclamation, "警告"
txtitem(3).SetFocus
Exit Sub
End If
If gintrMode = 1 Then
txtsql = "select * from repair"
Set mrc = ExecuteSQL(txtsql, msgtext)
mrc.AddNew
mrc.Fields(0) = Trim(cobid.Text)
For txtcount = 0 To 5
mrc.Fields(txtcount + 1) = txtitem(txtcount)
Next txtcount
mrc.Update
mrc.Close
MsgBox "添加信息成功!", vbOKOnly + vbExclamation, "添加"
End If
If gintrMode = 2 Then
txtsql = "delete from repair where wx_id='" & Trim(frmrepairlist.msglist.TextMatrix(frmrepairlist.msglist.Row, 1)) & "' and wx_date='" & Trim(frmrepairlist.msglist.TextMatrix(frmrepairlist.msglist.Row, 2)) & "'"
ExecuteSQL txtsql, msgtext
txtsql = "select * from repair"
Set mrc = ExecuteSQL(txtsql, msgtext)
mrc.AddNew
mrc.Fields(0) = Trim(cobid.Text)
For txtcount = 0 To 5
mrc.Fields(txtcount + 1) = txtitem(txtcount)
Next txtcount
mrc.Update
mrc.Close
MsgBox "修改信息成功!", vbOKOnly + vbExclamation, "修改"
flagrEdit = True
End If
If gintrMode = 1 Then
cobid.Text = ""
For txtcount = 0 To 5
txtitem(txtcount) = ""
Next txtcount
End If
If gintrMode = 2 Then
Unload Me
If flagrEdit Then
Unload frmrepairlist
End If
frmrepairlist.txtsql = ""
frmrepairlist.Show
End If
End Sub
Private Sub cobid_Change()
txtchange = True
End Sub
Private Sub Form_Load()
Dim txtcount As Integer
Dim msgtext As String
Me.Left = 3420
Me.Top = 1695
If gintrMode = 1 Then
Me.Caption = Me.Caption & "添加"
txtsql = "select DISTINCT cl_id from vehicle"
Set mrc = ExecuteSQL(txtsql, msgtext)
If Not mrc.EOF Then
Do While Not mrc.EOF
cobid.AddItem Trim(mrc!cl_id)
mrc.MoveNext
Loop
End If
mrc.Close
End If
If gintrMode = 2 Then
Set mrc = ExecuteSQL(txtsql, msgtext)
With mrc
If (.Fields(0) & "") <> "" Then
cobid.Text = .Fields(0)
End If
For txtcount = 0 To 5
If Trim(.Fields(txtcount + 1) & "") <> "" Then
txtitem(txtcount) = Trim(.Fields(txtcount + 1))
End If
Next txtcount
End With
mrc.Close
Me.Caption = Me.Caption & "修改"
txtsql = "select DISTINCT cl_id from vehicle" '给下拉框添加信息
Set mrc = ExecuteSQL(txtsql, msgtext)
If Not mrc.EOF Then
Do While Not mrc.EOF
cobid.AddItem Trim(mrc!cl_id)
mrc.MoveNext
Loop
End If
mrc.Close
txtchange = False
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
txtchange = True
End Sub
Private Sub txtitem_Change(Index As Integer)
txtchange = True
End Sub
Private Sub txtitem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -