?? form10.frm
字號:
Top = 480
Width = 1815
End
End
Begin StoneXP.XPButton XPButton3
Height = 495
Left = 6720
TabIndex = 2
Top = 6960
Width = 1215
_ExtentX = 2143
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "退 出"
MouseIcon = "Form10.frx":0638
MousePointer = 99
End
Begin StoneXP.XPButton XPButton2
Height = 495
Left = 3360
TabIndex = 1
Top = 6960
Width = 1215
_ExtentX = 2143
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "打印預覽"
MouseIcon = "Form10.frx":0952
MousePointer = 99
End
Begin FlexCell.Grid Grid1
Height = 3855
Left = 0
TabIndex = 0
Top = 360
Width = 10695
_ExtentX = 18865
_ExtentY = 6800
Cols = 5
Rows = 30
End
End
Attribute VB_Name = "Form10"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim str, str1 As String
Dim i As Integer
Private Sub Combo1_LostFocus()
Set mdbrs2 = mdbconn.Execute("select 車牌號 from 車輛表 where 單位名稱='" & Combo1.Text & "'")
Combo2.Clear
Do While Not mdbrs2.EOF
' MsgBox mdbrs2.Fields(0)
Combo2.AddItem mdbrs2.Fields(0)
mdbrs2.MoveNext
Loop
End Sub
Private Sub Combo4_LostFocus()
Set mdbrs2 = mdbconn.Execute("select 車牌號 from 車輛表 where 單位名稱='" & Combo4.Text & "'")
Combo5.Clear
Do While Not mdbrs2.EOF
' MsgBox mdbrs2.Fields(0)
Combo5.AddItem mdbrs2.Fields(0)
mdbrs2.MoveNext
Loop
End Sub
Private Sub Form_Load()
Grid1.SetRegisterInformation "CNwinndy", "W]vyY-nonvk-u\nty-Zbl_e-`hms^" '進行注冊
On Error GoTo finish
mdi = False
str = "select * from 加油信息"
XPButton2.Enabled = False
Grid1.Cols = 8
Grid1.Column(1).Width = 100
Grid1.Column(2).Width = 100
Grid1.Column(3).Width = 80
Grid1.Column(4).Width = 80
Grid1.Column(5).Width = 70
Grid1.Column(6).Width = 120
Grid1.Column(7).Width = 40
With Grid1
.AllowUserResizing = True
.DisplayFocusRect = False
.ExtendLastCol = True
.Appearance = Flat
.FixedRowColStyle = Flat
.ScrollBarStyle = Flat
.DefaultFont.Name = "Tahoma"
.DefaultFont.Size = 8
.BackColorFixed = RGB(84, 201, 134)
.BackColorFixedSel = RGB(167, 111, 177)
.BackColorBkg = RGB(198, 229, 211)
.BackColorScrollBar = RGB(167, 111, 177)
.BackColor1 = RGB(231, 235, 247)
.BackColor2 = RGB(198, 229, 211)
.GridColor = RGB(148, 190, 231)
.Column(0).Width = 0
End With
Set mdbrs = mdbconn.Execute("select * from 加油信息")
'For i = 0 To 6
' If i = 3 Then
' Grid1.Cell(0, i + 1).Text = mdbrs.Fields(i).Name & "(元/升)"
' Else
' If i = 4 Then
' Grid1.Cell(0, i + 1).Text = mdbrs.Fields(i).Name & "(升)"
' Else
' If i = 5 Then
' Grid1.Cell(0, i + 1).Text = mdbrs.Fields(i).Name & "(元)"
' Else
' Grid1.Cell(0, i + 1).Text = mdbrs.Fields(i).Name
' End If
' End If
' End If
'Next
Set mdbrs1 = mdbconn.Execute("select 單位名稱 from 客戶信息")
Do While Not mdbrs1.EOF
Combo1.AddItem mdbrs1.Fields(0)
Combo4.AddItem mdbrs1.Fields(0)
mdbrs1.MoveNext
Loop
For i = 1 To 12
Combo3.AddItem i
Next
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
Grid1.Rows = 2
i = 7
Grid1.Cols = i + 1
For i = 0 To 6
If i = 3 Then
Grid1.Cell(1, i + 1).Text = mdbrs.Fields(i).Name & "(元/升)"
Else
If i = 4 Then
Grid1.Cell(1, i + 1).Text = mdbrs.Fields(i).Name & "(升)"
Else
If i = 5 Then
Grid1.Cell(1, i + 1).Text = mdbrs.Fields(i).Name & "(元)"
Else
Grid1.Cell(1, i + 1).Text = mdbrs.Fields(i).Name
End If
End If
End If
Next
i = 2
Do While Not mdbrs.EOF
Grid1.Rows = Grid1.Rows + 1
For j = 1 To 7 '設定讀取列
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
For i = 1 To 7
Grid1.Column(i).Locked = True
Next
Exit Sub
finish:
MsgBox Err.Description
End Sub
Private Sub XPButton1_Click()
Set mdbrs = mdbconn.Execute("select * from 加油信息 where 單位名稱='" & Combo1.Text & "' and 車牌號='" & Combo2.Text & "' and 月份=val('" & Combo3.Text & "')")
Set mdbrs1 = mdbconn.Execute("select sum(單次加油金額) from 加油信息 where 單位名稱='" & Combo1.Text & "' and 車牌號='" & Combo2.Text & "' and 月份=val('" & Combo3.Text & "')")
Set mdbrs2 = mdbconn.Execute("select sum(加油量) from 加油信息 where 單位名稱='" & Combo1.Text & "' and 車牌號='" & Combo2.Text & "' and 月份=val('" & Combo3.Text & "')")
If mdbrs.EOF = True Then
MsgBox "沒有查找到記錄!!"
Else
Call callmain
XPButton2.Enabled = True
Grid1.Rows = Grid1.Rows + 1
i = Grid1.Rows - 1
str = "小 計:"
Grid1.Cell(i, 2).Text = str
Grid1.Cell(i, 5).Text = mdbrs2.Fields(0) & "升"
Grid1.Cell(i, 6).Text = mdbrs1.Fields(0) & "元"
End If
End Sub
Private Sub XPButton2_Click()
Grid1.PrintPreview
End Sub
Private Sub XPButton3_Click()
Unload Me
End Sub
Private Sub XPButton4_Click()
If Combo4.Text <> "" Then
str = "select * from 加油信息 where 單位名稱='" & Combo4.Text & "' order by 月份 asc"
Set mdbrs1 = mdbconn.Execute("select sum(單次加油金額) from 加油信息 where 單位名稱='" & Combo4.Text & "'")
Set mdbrs2 = mdbconn.Execute("select sum(加油量) from 加油信息 where 單位名稱='" & Combo4.Text & "'")
Set mdbrs3 = mdbconn.Execute("select 預存款余額 from 客戶信息 where 單位名稱='" & Combo4.Text & "'")
If Combo5.Text <> "" Then
str = "select * from 加油信息 where 單位名稱='" & Combo4.Text & "' and 車牌號='" & Combo5.Text & "' order by 月份 asc"
Set mdbrs1 = mdbconn.Execute("select sum(單次加油金額) from 加油信息 where 單位名稱='" & Combo4.Text & "' and 車牌號='" & Combo5.Text & "'")
Set mdbrs2 = mdbconn.Execute("select sum(加油量) from 加油信息 where 單位名稱='" & Combo4.Text & "' and 車牌號='" & Combo5.Text & "'")
End If
XPButton2.Enabled = True
Set mdbrs = mdbconn.Execute(str)
If mdbrs.EOF = True Then
MsgBox "沒有查找到記錄!!"
Else
Call callmain
Grid1.Rows = Grid1.Rows + 1
i = Grid1.Rows - 1
str = " 小 計:"
Grid1.Cell(i, 2).Text = str
Grid1.Cell(i, 5).Text = mdbrs2.Fields(0) & "升"
Grid1.Cell(i, 6).Text = mdbrs1.Fields(0) & "元"
Grid1.Rows = Grid1.Rows + 1
If Combo5.Text = "" Then
i = Grid1.Rows - 1
str = "本單位剩余余額:"
Grid1.Cell(i, 2).Text = str
Grid1.Cell(i, 6).Text = Int(mdbrs3.Fields(0) - mdbrs1.Fields(0)) & "元"
End If
End If
Else
MsgBox "請選擇單位!"
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -