?? frmreportdaily.frm
字號:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form frmReportDaily
Caption = "報表日報"
ClientHeight = 6360
ClientLeft = 60
ClientTop = 345
ClientWidth = 7905
Icon = "frmReportDaily.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6360
ScaleWidth = 7905
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox comRegion
Height = 300
Left = 5730
Style = 2 'Dropdown List
TabIndex = 6
Top = 180
Width = 1335
End
Begin VB.CommandButton cmdPrint
Caption = "打印(&P)"
Default = -1 'True
Height = 375
Left = 2085
TabIndex = 8
Top = 5760
Width = 1335
End
Begin VB.TextBox txtMonth
Height = 270
Left = 3135
TabIndex = 3
Top = 195
Width = 615
End
Begin VB.TextBox txtYear
Height = 270
Left = 1815
TabIndex = 1
Top = 195
Width = 615
End
Begin MSDBGrid.DBGrid DBGrid
Bindings = "frmReportDaily.frx":0442
Height = 3855
Left = 345
OleObjectBlob = "frmReportDaily.frx":0455
TabIndex = 7
Top = 840
Width = 7215
End
Begin VB.Data Data
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游標
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 645
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 5040
Width = 6615
End
Begin VB.CommandButton cmdExit
Cancel = -1 'True
Caption = "退出(&X)"
Height = 375
Left = 4485
TabIndex = 9
Top = 5760
Width = 1335
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "選擇分區:"
Height = 180
Left = 4770
TabIndex = 5
Top = 240
Width = 810
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "月"
Height = 180
Left = 3975
TabIndex = 4
Top = 240
Width = 180
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "年"
Height = 180
Left = 2655
TabIndex = 2
Top = 240
Width = 180
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "當前日期:"
Height = 180
Left = 840
TabIndex = 0
Top = 240
Width = 810
End
End
Attribute VB_Name = "frmReportDaily"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim fso As New FileSystemObject
Dim strAppName As String
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdPrint_Click()
Me.PrintForm
Printer.EndDoc
End Sub
Private Sub comRegion_Click()
'根據分區號選擇分區
Dim RegionNumber As Integer, strSQL As String
RegionNumber = comRegion.ListIndex + 1
strSQL = "select * from 主庫文件 where 分區=" & RegionNumber
Data.RecordSource = strSQL
Data.Refresh
End Sub
Private Sub Data_Reposition()
Data.Caption = "記錄:" & Data.Recordset.AbsolutePosition + 1
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 1 To RegionNumber
comRegion.AddItem i
Next
strAppName = App.Path & "\Main" & Year(Now) & Month(Now) & ".mdb"
Data.DatabaseName = strAppName
Data.RecordSource = "主庫文件"
End Sub
Private Sub txtMonth_LostFocus()
On Error GoTo ErrorDate '錯誤處理
If (Not IsNumeric(txtYear)) Or (Not IsNumeric(txtMonth)) Then
MsgBox "輸入錯誤!", vbExclamation + vbOKOnly, "報表日報"
txtYear.SetFocus
SendKeys "{Home}+{End}"
Exit Sub
End If
Dim strDate As String, dtmDate As Date
strDate = txtMonth & "/01/" & txtYear
dtmDate = CDate(strDate)
strAppName = App.Path & "\Main" & Year(dtmDate) & Month(dtmDate) & ".mdb"
If fso.FileExists(strAppName) Then
Data.DatabaseName = strAppName
Data.Refresh
Else
MsgBox "文件不存在!", vbExclamation + vbOKOnly, "報表日報"
End If
Exit Sub
ErrorDate:
If Err.Number = 13 Then
MsgBox "日期格式不對!", vbExclamation + vbOKOnly, "報表日報"
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -