?? form1.frm
字號:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Form1
Caption = "SQL使用技巧-日期數據查詢"
ClientHeight = 4380
ClientLeft = 60
ClientTop = 345
ClientWidth = 8325
LinkTopic = "Form1"
ScaleHeight = 4380
ScaleWidth = 8325
StartUpPosition = 1 '所有者中心
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "C:\mrjd\kfgl.mdb"
DefaultCursorType= 0 '缺省游標
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 450
Left = 4560
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "gzmx"
Top = -30
Visible = 0 'False
Width = 1140
End
Begin VB.CommandButton Command1
Caption = "退出"
Height = 360
Left = 6135
TabIndex = 0
Top = 3960
Width = 2115
End
Begin MSFlexGridLib.MSFlexGrid MS4
Bindings = "Form1.frx":0000
Height = 3480
Left = 60
TabIndex = 1
Top = 405
Width = 8205
_ExtentX = 14473
_ExtentY = 6138
_Version = 393216
FixedCols = 0
AllowUserResizing= 3
End
Begin MSComCtl2.DTPicker DTP1
Height = 285
Left = 615
TabIndex = 2
Top = 60
Width = 1425
_ExtentX = 2514
_ExtentY = 503
_Version = 393216
Format = 24444929
CurrentDate = 37132
End
Begin MSComCtl2.DTPicker DTP2
Height = 285
Left = 2490
TabIndex = 3
Top = 60
Width = 1410
_ExtentX = 2487
_ExtentY = 503
_Version = 393216
Format = 24444929
CurrentDate = 37132
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "日期"
Height = 300
Left = 90
TabIndex = 5
Top = 120
Width = 570
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "到"
Height = 285
Left = 2175
TabIndex = 4
Top = 120
Width = 240
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mydate1 As String
Dim MYDATE2 As String
Private Sub Form_Load()
'自動識別數據庫路徑
Data1.DatabaseName = App.Path & "\kfgl.mdb"
End Sub
Private Sub Form_Activate()
Data1.RecordSource = "select * from gzmx"
Data1.Refresh
DTP1.Value = Date - 30
DTP2.Value = Date
mydate1 = DTP1.Value
MYDATE2 = DTP2.Value
'增加第0列與第8列的列寬
MS4.ColWidth(0) = 12 * 25 * 4
MS4.ColWidth(8) = 12 * 25 * 5
End Sub
Private Sub DTP1_Change()
mydate1 = DTP1.Value
MYDATE2 = DTP2.Value
If DTP1.Value < DTP2.Value Then
Data1.RecordSource = "select * from gzmx where gzmx.日期 between " + Chr(35) + mydate1 + Chr(35) + "and " + Chr(35) + MYDATE2 + Chr(35) + "order by 日期,時間"
Data1.Refresh
Else
MsgBox "系統不允許日期顛倒"
DTP2.Value = DTP1.Value + 1
End If
End Sub
Private Sub DTP2_Change()
mydate1 = DTP1.Value
MYDATE2 = DTP2.Value
If DTP1.Value < DTP2.Value Then
Data1.RecordSource = "select * from gzmx where gzmx.日期 between " + Chr(35) + mydate1 + Chr(35) + "and " + Chr(35) + MYDATE2 + Chr(35) + "order by 日期,時間"
Data1.Refresh
Else
DTP2.Value = DTP1.Value + 1
MsgBox "系統不允許日期顛倒"
End If
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -