📄 form2.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{FAEEE763-117E-101B-8933-08002B2F4F5A}#1.1#0"; "DBLIST32.OCX"
Begin VB.Form Form2
Caption = "邮件数据管理程序-查询"
ClientHeight = 5085
ClientLeft = 60
ClientTop = 345
ClientWidth = 7800
LinkTopic = "Form2"
ScaleHeight = 5085
ScaleWidth = 7800
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command1
Caption = "返回"
Height = 375
Left = 6105
TabIndex = 14
Top = 4500
Width = 1395
End
Begin MSDBCtls.DBCombo DBCombo1
Bindings = "Form2.frx":0000
Height = 330
Left = 270
TabIndex = 13
Top = 240
Width = 4545
_ExtentX = 8017
_ExtentY = 582
_Version = 393216
ListField = "主题"
Text = ""
End
Begin VB.TextBox Text1
DataField = "内容"
DataSource = "Data1"
Height = 1995
Left = 270
MultiLine = -1 'True
TabIndex = 12
Top = 2370
Width = 7215
End
Begin VB.TextBox Text3
DataField = "发件人"
DataSource = "Data1"
Height = 345
Left = 270
TabIndex = 11
Top = 1680
Width = 7215
End
Begin VB.TextBox Text2
DataField = "主题"
DataSource = "Data1"
Height = 345
Left = 270
TabIndex = 10
Top = 1050
Width = 7215
End
Begin MSComCtl2.DTPicker DTP1
Height = 315
Left = 5940
TabIndex = 0
Top = 180
Width = 1455
_ExtentX = 2566
_ExtentY = 556
_Version = 393216
Format = 19726337
CurrentDate = 36636
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "E:\明日vb编程500例\网络(新)\1邮件数据管理程序\email.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 405
Left = 270
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "email"
Top = 4470
Width = 5685
End
Begin MSComCtl2.DTPicker DTP2
Height = 315
Left = 5940
TabIndex = 1
Top = 540
Width = 1455
_ExtentX = 2566
_ExtentY = 556
_Version = 393216
Format = 19726337
CurrentDate = 36636
End
Begin VB.Label Label8
Caption = "Label7"
DataField = "时间"
DataSource = "Data2"
Height = 255
Left = 5610
TabIndex = 9
Top = 2100
Width = 1275
End
Begin VB.Label Label7
Caption = "Label7"
DataField = "日期"
DataSource = "Data2"
Height = 255
Left = 3660
TabIndex = 8
Top = 2085
Width = 1275
End
Begin VB.Label Label6
Caption = "日期: 时间:"
Height = 285
Left = 3060
TabIndex = 7
Top = 2100
Width = 3405
End
Begin VB.Label Label5
Caption = "主题:"
Height = 255
Left = 270
TabIndex = 6
Top = 825
Width = 795
End
Begin VB.Label Label4
Caption = "收件人:"
Height = 255
Left = 270
TabIndex = 5
Top = 1440
Width = 1395
End
Begin VB.Label Label3
Caption = "内容:"
Height = 375
Left = 285
TabIndex = 4
Top = 2100
Width = 1395
End
Begin VB.Label Label2
Caption = "终止日期:"
Height = 255
Left = 5040
TabIndex = 3
Top = 600
Width = 915
End
Begin VB.Label Label1
Caption = "开始日期:"
Height = 255
Left = 5040
TabIndex = 2
Top = 240
Width = 915
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
DTP1.Value = Date - 10
DTP2.Value = Date
Data1.DatabaseName = App.Path & "\email.mdb"
End Sub
Private Sub DTP1_Change() '设置日期范围
If DTP1.Value < DTP2.Value Then
Data1.RecordSource = "select * from email where email.日期 between " + Chr(35) + Str(DTP1.Value) + Chr(35) + "and " + Chr(35) + Str(DTP2.Value) + Chr(35) + "order by 日期,时间"
Data1.Refresh
Else
MsgBox "系统不允许日期颠倒"
DTP2.Value = DTP1.Value + 1
End If
End Sub
Private Sub DTP2_Change() '设置日期范围
If DTP1.Value < DTP2.Value Then
Data1.RecordSource = "select * from email where email.日期 between " + Chr(35) + Str(DTP1.Value) + Chr(35) + "and " + Chr(35) + Str(DTP2.Value) + Chr(35) + "order by 日期,时间"
Data1.Refresh
Else
DTP2.Value = DTP1.Value + 1
MsgBox "系统不允许日期颠倒"
End If
End Sub
Private Sub command1_Click()
Load Form1
Form1.Show
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -