📄 frmmonthlyquery.frm
字号:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form frmMonthlyQuery
Caption = "当月查询"
ClientHeight = 6675
ClientLeft = 60
ClientTop = 345
ClientWidth = 8205
Icon = "frmMonthlyQuery.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6675
ScaleWidth = 8205
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdPrint
Caption = "打印(&P)"
Default = -1 'True
Height = 375
Left = 2475
TabIndex = 5
Top = 6120
Width = 1095
End
Begin MSDBGrid.DBGrid DBGrid1
Bindings = "frmMonthlyQuery.frx":0442
Height = 4575
Left = 255
OleObjectBlob = "frmMonthlyQuery.frx":0456
TabIndex = 4
Top = 720
Width = 7695
End
Begin VB.Data Data1
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 735
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 5520
Width = 6735
End
Begin VB.CommandButton cmdExit
Cancel = -1 'True
Caption = "退出(&X)"
Height = 375
Left = 4635
TabIndex = 6
Top = 6120
Width = 1095
End
Begin VB.ComboBox comStyle
Height = 300
Left = 5595
Style = 2 'Dropdown List
TabIndex = 3
Top = 240
Width = 1695
End
Begin VB.TextBox txtCurrentDate
Height = 300
Left = 2010
TabIndex = 1
Top = 240
Width = 1695
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "选择类型:"
Height = 180
Left = 4500
TabIndex = 2
Top = 300
Width = 810
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "当前日期:"
Height = 180
Left = 915
TabIndex = 0
Top = 300
Width = 810
End
End
Attribute VB_Name = "frmMonthlyQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim strAppName As String, strSQL As String
Dim fso As New FileSystemObject
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdPrint_Click()
Me.PrintForm
Printer.EndDoc
End Sub
Private Sub comStyle_Click()
strSQL = "select * from 主库文件 order by " & comStyle.Text
Data1.RecordSource = strSQL
Data1.Refresh
End Sub
Private Sub Data1_Reposition()
Data1.Caption = "记录:" & Data1.Recordset.AbsolutePosition + 1
End Sub
Private Sub Form_Load()
comStyle.AddItem "发票号"
comStyle.AddItem "编号"
comStyle.AddItem "户名"
strAppName = App.Path & "\Main" & Year(Now) & Month(Now) & ".mdb"
Data1.DatabaseName = strAppName
Data1.RecordSource = "主库文件"
Data1.Refresh
End Sub
Private Sub txtCurrentDate_LostFocus()
On Error GoTo ErrorDate '错误处理
Dim dtmDate As Date
dtmDate = CDate(txtCurrentDate)
strAppName = App.Path & "\Main" & Year(dtmDate) & Month(dtmDate) & ".mdb"
If fso.FileExists(strAppName) Then
Data1.DatabaseName = strAppName
Data1.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 + -