?? form7.frm
字號:
VERSION 5.00
Object = "{CFA7AFF4-3242-4269-9172-7389D695AE01}#1.0#0"; "StoneXP.ocx"
Object = "{DAAC6951-59A4-4C08-9D6E-FE3919B64861}#1.0#0"; "FlexCell.ocx"
Begin VB.Form Form7
BorderStyle = 1 'Fixed Single
Caption = "車輛管理"
ClientHeight = 5190
ClientLeft = 45
ClientTop = 375
ClientWidth = 6780
LinkTopic = "Form7"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5190
ScaleWidth = 6780
Begin FlexCell.Grid Grid1
Height = 3975
Left = 0
TabIndex = 0
Top = 360
Width = 6735
_ExtentX = 11880
_ExtentY = 7011
Cols = 5
Rows = 30
End
Begin StoneXP.XPButton XPButton5
Height = 375
Left = 4800
TabIndex = 1
Top = 4680
Width = 975
_ExtentX = 1720
_ExtentY = 661
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "退 出"
MouseIcon = "Form7.frx":0000
MousePointer = 99
End
Begin StoneXP.XPButton XPButton4
Height = 375
Left = 3840
TabIndex = 2
Top = 4680
Width = 975
_ExtentX = 1720
_ExtentY = 661
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "刪 除"
MouseIcon = "Form7.frx":031A
MousePointer = 99
End
Begin StoneXP.XPButton XPButton3
Height = 375
Left = 2880
TabIndex = 3
Top = 4680
Width = 975
_ExtentX = 1720
_ExtentY = 661
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "修 改"
MouseIcon = "Form7.frx":0634
MousePointer = 99
End
Begin StoneXP.XPButton XPButton2
Height = 375
Left = 1920
TabIndex = 4
Top = 4680
Width = 975
_ExtentX = 1720
_ExtentY = 661
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "保 存"
MouseIcon = "Form7.frx":094E
MousePointer = 99
End
Begin StoneXP.XPButton XPButton1
Height = 375
Left = 960
TabIndex = 5
Top = 4680
Width = 975
_ExtentX = 1720
_ExtentY = 661
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "添 加"
MouseIcon = "Form7.frx":0C68
MousePointer = 99
End
End
Attribute VB_Name = "Form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim gridsave As Boolean
Dim gridedit As Boolean
Dim griddelete As Boolean
Private Sub Form_Load()
mdi = False
'On Error GoTo finish
Set mdbrs1 = mdbconn.Execute("select * from 車輛表")
Grid1.SetRegisterInformation "CNwinndy", "W]vyY-nonvk-u\nty-Zbl_e-`hms^" '進行注冊
With Grid1
.AllowUserResizing = True
.DisplayFocusRect = False
.ExtendLastCol = True
.Appearance = Flat
.FixedRowColStyle = Flat
.ScrollBarStyle = Flat
.Cols = 5
.DefaultFont.Name = "Tahoma"
.DefaultFont.Size = 8
.BackColorFixed = RGB(90, 158, 214)
.BackColorFixedSel = RGB(110, 180, 230)
.BackColorBkg = RGB(90, 158, 214)
.BackColorScrollBar = RGB(231, 235, 247)
.BackColor1 = RGB(231, 235, 247)
.BackColor2 = RGB(239, 243, 255)
.GridColor = RGB(148, 190, 231)
.AllowUserResizing = True
.DisplayFocusRect = False
.ExtendLastCol = True
.Appearance = Flat
.FixedRowColStyle = Flat
.ScrollBarStyle = Flat
.GridColor = RGB(148, 190, 231)
.DefaultFont.Name = "Tahoma"
.DefaultFont.Size = 8
.Column(0).Width = 0
.Column(1).Width = 20
.Column(2).Width = 100
.Column(3).Width = 100
.Column(4).Width = 100
.Column(2).CellType = cellComboBox
.ComboBox(2).Clear
Set mdbrs2 = mdbconn.Execute("select 單位名稱 from 客戶信息")
Do While Not mdbrs2.EOF
.ComboBox(2).AddItem mdbrs2.Fields(0).Value
mdbrs2.MoveNext
Loop
.Column(4).CellType = cellComboBox
.ComboBox(4).Clear
Set mdbrs2 = mdbconn.Execute("select * from 油價表")
Do While Not mdbrs2.EOF
.ComboBox(4).AddItem mdbrs2.Fields(1).Value & mdbrs2.Fields(2).Value & "~" & mdbrs2.Fields(3).Value
mdbrs2.MoveNext
Loop
End With
Call callmain
Grid1.Column(1).Locked = True
gridsave = False
gridedit = True
griddelete = True
mdi = False
Exit Sub
finish:
MsgBox Err.Description
End Sub
Private Sub Form_Unload(Cancel As Integer)
mdi = True
End Sub
Private Sub callmain()
'On Error GoTo finish
gridsave = False
gridedit = True
griddelete = True
Set mdbrs = mdbconn.Execute("select * from 車輛表")
Grid1.Rows = 1
i = 4
Grid1.Cols = i + 1
For i = 0 To 3
Grid1.Cell(0, i + 1).Text = mdbrs.Fields(i).Name
Next
i = 1
Do While Not mdbrs.EOF
Grid1.Rows = Grid1.Rows + 1
For j = 1 To 4 '設定讀取列
If mdbrs.Fields(j - 1) = Null Then '空值的處理
Grid1.Cell(i, j).Text = ""
Else
Grid1.Cell(i, j).Text = mdbrs.Fields(j - 1)
End If
Next
i = i + 1
mdbrs.MoveNext '讀取下一記錄
Loop
Grid1.Column(1).Locked = True
Exit Sub
finish:
MsgBox Err.Description
End Sub
Private Sub XPButton1_Click()
On Error GoTo finish
gridsave = True
gridedit = False
griddelete = False
Set mdbrs = mdbconn.Execute("select * from 車輛表")
Grid1.Rows = 1
Grid1.Rows = 2
Grid1.Column(1).Locked = True
Grid1.Cell(1, 2).SetFocus
Exit Sub
finish:
MsgBox Err.Description
End Sub
Private Sub XPButton2_Click()
On Error GoTo finish
If gridsave = False Then
MsgBox "不支持保存操作!", vbInformation, "當前不支持"
Exit Sub
End If
If Grid1.Cell(1, 2).Text <> "" And Grid1.Cell(1, 3).Text <> "" And Grid1.Cell(1, 4).Text <> "" Then
Set mdbrs = mdbconn.Execute("insert into 車輛表(單位名稱,車牌號,加油型號) values('" & Grid1.Cell(1, 2).Text & "','" & Grid1.Cell(1, 3).Text & "','" & Grid1.Cell(1, 4).Text & "')")
MsgBox "提交成功!", vbInformation, ""
Call callmain
Else
MsgBox "單位名稱,車牌號,加油型號,預存款都不可以是空格!", vbInformation, "錯誤提示"
End If
Exit Sub
finish:
MsgBox Err.Description
End Sub
Private Sub XPButton3_Click()
On Error GoTo finish
If gridedit = False Then
MsgBox "當前修改操作不被允許!", vbInformation, "非使用對象"
Exit Sub
End If
For i = 1 To Grid1.Rows - 1
Set mdbrs = mdbconn.Execute("update 車輛表 set 單位名稱='" & Grid1.Cell(i, 2).Text & "',車牌號='" & Grid1.Cell(i, 3).Text & "',加油型號='" & Grid1.Cell(i, 4).Text & "' where 編號=val('" & Grid1.Cell(i, 1).Text & "')")
Next
MsgBox "修改的數據己經完成", vbInformation, "完成操作"
Call callmain
Exit Sub
finish:
MsgBox Err.Description
End Sub
Private Sub XPButton4_Click()
On Error GoTo finish
If griddelete = False Then
MsgBox "當前刪除操作不被允許!", vbInformation, "非使用對象"
Exit Sub
End If
If hang = 0 Then
MsgBox "沒有選擇用戶或者沒有用戶可以刪除!", vbInformation, "非使用對象"
Exit Sub
End If
Set mdbrs = mdbconn.Execute("delete from 車輛表 where 編號=val('" & Grid1.Cell(hang, 1).Text & "')")
MsgBox "目標己刪除,請刷新數據!", vbInformation, "刪除成功"
Call callmain
Exit Sub
finish:
MsgBox Err.Description
End Sub
Private Sub XPButton5_Click()
Unload Me
End Sub
Private Sub Grid1_RowColChange(ByVal Row As Long, ByVal Col As Long)
hang = Row
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -