?? jiayou.frm
字號(hào):
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Begin VB.Form jiayou
Caption = "車輛油量"
ClientHeight = 7110
ClientLeft = 60
ClientTop = 345
ClientWidth = 8760
LinkTopic = "Form1"
ScaleHeight = 7110
ScaleWidth = 8760
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "查 詢"
Height = 495
Left = 2640
TabIndex = 26
Top = 6360
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "退 出"
Height = 495
Left = 3720
TabIndex = 25
Top = 6360
Width = 975
End
Begin VB.CommandButton Command1
Caption = "保 存"
Height = 495
Left = 1560
TabIndex = 24
Top = 6360
Width = 1095
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
Height = 390
Left = 2640
TabIndex = 23
Top = 3600
Visible = 0 'False
Width = 1455
End
Begin MSMask.MaskEdBox Mask
Height = 375
Left = 960
TabIndex = 22
Top = 3240
Visible = 0 'False
Width = 1455
_ExtentX = 2566
_ExtentY = 661
_Version = 393216
MaxLength = 11
Mask = "9999年99月99日"
PromptChar = "_"
End
Begin VB.TextBox Text1
Height = 375
Left = 4920
TabIndex = 21
Top = 720
Width = 1335
End
Begin VB.ComboBox Combo4
Height = 300
Left = 1800
TabIndex = 19
Top = 720
Width = 1335
End
Begin VB.ComboBox Combo3
Height = 300
Left = 5040
TabIndex = 17
Top = 240
Width = 1215
End
Begin VB.ComboBox Combo2
Height = 300
Left = 3000
TabIndex = 15
Top = 240
Width = 1335
End
Begin VB.ComboBox Combo1
Height = 300
Left = 840
TabIndex = 13
Top = 240
Width = 1215
End
Begin VB.PictureBox Picture1
Height = 735
Left = 120
ScaleHeight = 675
ScaleWidth = 7155
TabIndex = 1
Top = 1200
Width = 7215
Begin VB.Label Label10
Caption = "節(jié) 油"
Height = 375
Left = 6120
TabIndex = 11
Top = 360
Width = 735
End
Begin VB.Label Label9
Caption = "百 公 里"
Height = 375
Left = 6000
TabIndex = 10
Top = 120
Width = 975
End
Begin VB.Line Line5
X1 = 5760
X2 = 5760
Y1 = 0
Y2 = 720
End
Begin VB.Label Label8
Caption = "耗油(升)"
Height = 255
Left = 4800
TabIndex = 9
Top = 360
Width = 735
End
Begin VB.Label Label7
Caption = "百 公 里"
Height = 255
Left = 4800
TabIndex = 8
Top = 120
Width = 975
End
Begin VB.Line Line4
X1 = 4560
X2 = 4560
Y1 = 0
Y2 = 720
End
Begin VB.Label Label6
Caption = "公里數(shù)"
Height = 255
Left = 3840
TabIndex = 7
Top = 240
Width = 615
End
Begin VB.Line Line3
X1 = 3720
X2 = 3720
Y1 = 0
Y2 = 720
End
Begin VB.Label Label5
Caption = "(升)"
Height = 255
Left = 2880
TabIndex = 6
Top = 360
Width = 615
End
Begin VB.Label Label4
Caption = "加 油 量"
Height = 255
Left = 2760
TabIndex = 5
Top = 120
Width = 1455
End
Begin VB.Line Line2
X1 = 2520
X2 = 2520
Y1 = 0
Y2 = 720
End
Begin VB.Label Label3
Caption = " 公 里 數(shù)"
Height = 375
Left = 1440
TabIndex = 4
Top = 360
Width = 975
End
Begin VB.Label Label2
Caption = "累 計(jì)"
Height = 255
Left = 1680
TabIndex = 3
Top = 120
Width = 735
End
Begin VB.Label Label1
Caption = "日 期"
Height = 255
Left = 240
TabIndex = 2
Top = 240
Width = 855
End
Begin VB.Line Line1
X1 = 1320
X2 = 1320
Y1 = 0
Y2 = 720
End
End
Begin MSFlexGridLib.MSFlexGrid MSF
Height = 4335
Left = 120
TabIndex = 0
Top = 1680
Width = 7215
_ExtentX = 12726
_ExtentY = 7646
_Version = 393216
FixedCols = 0
AllowUserResizing= 3
End
Begin VB.Label Label15
Caption = "上次累計(jì)公里數(shù):"
Height = 255
Left = 3360
TabIndex = 20
Top = 840
Width = 1455
End
Begin VB.Label Label14
Caption = "百公里耗油標(biāo)準(zhǔn):"
Height = 255
Left = 360
TabIndex = 18
Top = 840
Width = 1455
End
Begin VB.Label Label13
Caption = "司機(jī):"
Height = 255
Left = 4440
TabIndex = 16
Top = 360
Width = 855
End
Begin VB.Label Label12
Caption = "車牌:"
Height = 255
Left = 2280
TabIndex = 14
Top = 360
Width = 615
End
Begin VB.Label Label11
Caption = "車型:"
Height = 255
Left = 360
TabIndex = 12
Top = 360
Width = 615
End
End
Attribute VB_Name = "jiayou"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim i As Integer
Dim result, result1, result2 As Recordset
Dim sql As String
Private Sub Combo1_Click()
sql = "select * from cheliangmingcheng where 車型='" & Trim(Combo1.Text) & "'"
result.Open sql, con, adOpenStatic, adLockOptimistic
If result.RecordCount <> 0 Then
result.MoveFirst
Do While Not result.EOF
Combo2.Text = Trim(result("車牌"))
Combo3.Text = Trim(result("司機(jī)"))
Combo4.Text = Trim(result("百公里耗油標(biāo)準(zhǔn)"))
result.MoveNext
Loop
End If
result.Close
sql = "select * from youliang where 車型='" & Trim(Combo1.Text) & "' and 車牌='" & Trim(Combo2.Text) & "' order by 日期 desc"
result.Open sql, con, adOpenStatic, adLockOptimistic
If result.RecordCount <> 0 Then
result.MoveFirst
Text1.Text = Trim(result("累計(jì)公里數(shù)"))
Else
Text1.Text = 0
End If
result.Close
'''''''清空表格
MSF.Clear
Text2.Visible = False
End Sub
Private Sub Command1_Click()
If MsgBox("確認(rèn)保存嗎?", vbYesNo, "警告") = vbYes Then
For i = 1 To MSF.Rows - 1
If Trim(MSF.TextArray(i * MSF.Cols)) <> "" And Trim(MSF.TextArray(i * MSF.Cols + 1)) <> "" And Trim(MSF.TextArray(i * MSF.Cols + 2)) <> "" Then
sql = "delete from youliang where 日期='" & Trim(MSF.TextArray(i * MSF.Cols)) & "'and 車型='" & Trim(Combo1.Text) & "' and 車牌='" & Trim(Combo2.Text) & "' "
result.Open sql, con, adOpenStatic, adLockOptimistic
sql = "insert into youliang values('" & Trim(MSF.TextArray(i * MSF.Cols)) & "','" & Trim(MSF.TextArray(i * MSF.Cols + 1)) & "','" & Trim(MSF.TextArray(i * MSF.Cols + 2)) & "','" & Trim(MSF.TextArray(i * MSF.Cols + 3)) & "','" & Trim(MSF.TextArray(i * MSF.Cols + 4)) & "','" & Trim(MSF.TextArray(i * MSF.Cols + 5)) & "','" & Trim(Combo1.Text) & "','" & Trim(Combo2.Text) & "','" & Trim(Combo3.Text) & "','" & Trim(Combo4.Text) & "')"
result.Open sql, con, adOpenStatic, adLockOptimistic
End If
Next i
MsgBox "保存結(jié)束"
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
jiayouchaxun.Show 1
End Sub
Private Sub Form_Load()
Move Screen.Width / 2 - jiayou.Width / 2, Screen.Height / 2 - jiayou.Height / 2
MSF.FormatString = " |^ |^ |^ |^ |^ "
MSF.Rows = 10
For i = 1 To MSF.Rows - 1
MSF.RowHeight(i) = 350
Next i
Call aa
Set result = New Recordset
sql = "select * from cheliangmingcheng "
result.Open sql, con, adOpenStatic, adLockOptimistic
If result.RecordCount <> 0 Then
result.MoveFirst
Do While Not result.EOF
Combo1.AddItem Trim(result("車型"))
result.MoveNext
Loop
End If
result.Close
End Sub
Private Sub Mask_Change()
If IsDate(Mask.Text) = True Then
MSF.Text = Mask.Text
Mask.Visible = False
' Mask.Text = "____年__月__日"
End If
End Sub
Private Sub MSF_Click()
If MSF.Col = 0 Then
If MSF.Row >= 2 Then
Text1.Text = Trim(MSF.TextArray((MSF.Row - 1) * MSF.Cols + 1))
End If
Text2.Visible = False
Mask.Visible = True
Mask.SetFocus
' If Trim(MSF.TextArray(MSF.Row * MSF.Cols)) <> "" Then
' MsgBox "123456"
' Mask.Text = Trim(MSF.TextArray(MSF.Row * MSF.Cols))
' Else
' Mask.Text = "____年__月__日"
' End If
Mask.Top = MSF.Top + MSF.CellTop
Mask.Left = MSF.Left + MSF.CellLeft
Mask.Width = MSF.CellWidth
Else
Mask.Visible = False
Text2.Visible = True
Text2.SetFocus
Text2.Text = Trim(MSF.TextArray(MSF.Row * MSF.Cols + MSF.Col))
Text2.Top = MSF.Top + MSF.CellTop
Text2.Left = MSF.Left + MSF.CellLeft
Text2.Width = MSF.CellWidth
End If
End Sub
Private Sub Text2_Change()
MSF.Text = Text2.Text
If MSF.Col = 2 Then
MSF.TextArray(MSF.Row * MSF.Cols + 3) = Val(Trim(MSF.TextArray(MSF.Row * MSF.Cols + 1))) - Val(Text1.Text)
MSF.TextArray(MSF.Row * MSF.Cols + 4) = Round(Val(Trim(MSF.TextArray(MSF.Row * MSF.Cols + 2))) / Val(Trim(MSF.TextArray(MSF.Row * MSF.Cols + 3))) * 100, 2)
MSF.TextArray(MSF.Row * MSF.Cols + 5) = Round(Val(Trim(Combo4.Text)) - Val(Trim(MSF.TextArray(MSF.Row * MSF.Cols + 4))), 2)
End If
End Sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -