📄 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 + -