📄 frmsrchlockrecord1.frm
字号:
VERSION 5.00
Begin VB.Form FrmSrchLockRecord
Caption = "查询历史开锁记录"
ClientHeight = 6795
ClientLeft = 255
ClientTop = 540
ClientWidth = 9480
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 6795
ScaleWidth = 9480
Begin VB.Data Data2
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 4440
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 1800
Visible = 0 'False
Width = 1575
End
Begin VB.CommandButton CmdCancel
Caption = "取消"
Height = 375
Left = 9600
TabIndex = 20
Top = 120
Width = 975
End
Begin VB.CommandButton CmdDelete
Caption = "删除"
Height = 375
Left = 7320
TabIndex = 19
Top = 120
Width = 975
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 4440
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "AllLockedRecord"
Top = 1200
Visible = 0 'False
Width = 1575
End
Begin VB.ListBox LstRoomBook
BackColor = &H00E0E0E0&
Height = 1740
ItemData = "FrmSrchLockRecord1.frx":0000
Left = 960
List = "FrmSrchLockRecord1.frx":0002
TabIndex = 18
Top = 360
Visible = 0 'False
Width = 1455
End
Begin VB.CommandButton CmdPrint
Caption = "报表"
Height = 375
Left = 8400
TabIndex = 3
Top = 120
Width = 1095
End
Begin VB.PictureBox Picture1
BackColor = &H00E0E0E0&
Height = 375
Index = 7
Left = 2880
ScaleHeight = 315
ScaleWidth = 1635
TabIndex = 11
Top = 120
Width = 1695
Begin VB.TextBox TxtDay
BackColor = &H00E0E0E0&
BorderStyle = 0 'None
Height = 255
Index = 0
Left = 1200
MaxLength = 2
TabIndex = 14
Top = 20
Width = 255
End
Begin VB.TextBox TxtYear
BackColor = &H00E0E0E0&
BorderStyle = 0 'None
Height = 255
Index = 0
Left = 40
MaxLength = 4
TabIndex = 13
Top = 20
Width = 435
End
Begin VB.TextBox TxtMonth
BackColor = &H00E0E0E0&
BorderStyle = 0 'None
Height = 255
Index = 0
Left = 720
MaxLength = 2
TabIndex = 12
Top = 20
Width = 255
End
Begin VB.Label Label1
BackColor = &H00E0E0E0&
Caption = "月"
Height = 375
Index = 18
Left = 960
TabIndex = 17
Top = 40
Width = 255
End
Begin VB.Label Label1
BackColor = &H00E0E0E0&
Caption = "年"
Height = 375
Index = 17
Left = 480
TabIndex = 16
Top = 40
Width = 255
End
Begin VB.Label Label1
BackColor = &H00E0E0E0&
Caption = "日"
Height = 375
Index = 16
Left = 1440
TabIndex = 15
Top = 40
Width = 255
End
End
Begin VB.PictureBox Picture1
BackColor = &H00E0E0E0&
Height = 375
Index = 6
Left = 5160
ScaleHeight = 315
ScaleWidth = 1635
TabIndex = 4
Top = 120
Width = 1695
Begin VB.TextBox TxtMonth
BackColor = &H00E0E0E0&
BorderStyle = 0 'None
Height = 255
Index = 1
Left = 720
MaxLength = 2
TabIndex = 7
Top = 20
Width = 255
End
Begin VB.TextBox TxtYear
BackColor = &H00E0E0E0&
BorderStyle = 0 'None
Height = 255
Index = 1
Left = 40
MaxLength = 4
TabIndex = 6
Top = 20
Width = 435
End
Begin VB.TextBox TxtDay
BackColor = &H00E0E0E0&
BorderStyle = 0 'None
Height = 255
Index = 1
Left = 1200
MaxLength = 2
TabIndex = 5
Top = 20
Width = 255
End
Begin VB.Label Label1
BackColor = &H00E0E0E0&
Caption = "日"
Height = 375
Index = 15
Left = 1440
TabIndex = 10
Top = 40
Width = 255
End
Begin VB.Label Label1
BackColor = &H00E0E0E0&
Caption = "年"
Height = 375
Index = 14
Left = 480
TabIndex = 9
Top = 40
Width = 255
End
Begin VB.Label Label1
BackColor = &H00E0E0E0&
Caption = "月"
Height = 375
Index = 13
Left = 960
TabIndex = 8
Top = 40
Width = 255
End
End
Begin VB.CommandButton CmdRoomBook
Caption = ">>"
Height = 375
Left = 2400
TabIndex = 2
Top = 120
Width = 375
End
Begin VB.TextBox TxtShortRoomNumber
Height = 375
Left = 960
TabIndex = 1
Top = 120
Width = 1455
End
Begin VB.Line Line2
BorderWidth = 2
X1 = 4560
X2 = 5160
Y1 = 240
Y2 = 240
End
Begin VB.Label Label1
Caption = "房间号"
Height = 255
Index = 0
Left = 240
TabIndex = 0
Top = 240
Width = 735
End
End
Attribute VB_Name = "FrmSrchLockRecord"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'************************
'* 功能:获得默认的有效日期,时间
'* 作者:韩国栋
'* 时间:2000-2-12
'************************
Sub ValidDate()
gValidEndDate = Date + 1
TxtYear(0).Text = Year(Date)
TxtMonth(0).Text = Right("00" & Month(Date), 2)
TxtDay(0).Text = Right("00" & Day(Date), 2)
TxtYear(1).Text = Year(gValidEndDate)
TxtMonth(1).Text = Right("00" & Month(gValidEndDate), 2)
TxtDay(1).Text = Right("00" & Day(gValidEndDate), 2)
End Sub
Private Sub CmdCancel_Click()
Unload Me
End Sub
Private Sub CmdDelete_Click()
Dim TwoMonthSDate As String
Dim dTmp As Date
dTmp = DateAdd("m", -2, Date)
TwoMonthSDate = "" & Year(dTmp) & "年" & Right("00" & Month(dTmp), 2) & "月" & Right("00" & Day(dTmp), 2) & "日" & "23:59:00"
DB_ICData.Execute "delete * from AllLockedRecord where unlocksdate<='" & TwoMonthSDate & "'"
Data1.Refresh
End Sub
Private Sub CmdPrint_Click()
On Error GoTo ErrHand:
CrystalReport1.Action = 1
Exit Sub
ErrHand:
End Sub
Private Sub CmdRoomBook_Click()
LstRoomBook.Clear
With RC_Room
If Not (.BOF And .EOF) Then
.MoveFirst
While Not .EOF
LstRoomBook.AddItem .Fields("ShortroomNumber")
.MoveNext
Wend
End If
End With
LstRoomBook.Visible = True
LstRoomBook.SetFocus
End Sub
Private Sub Form_Load()
Data1.DatabaseName = SystemDir & "ICData.mdb"
Data2.DatabaseName = SystemDir & "ICData.mdb"
Data2.RecordSource = "select * from AllLockedRecord"
'Data2.RecordSource = "select ShortRoomNumber as 房间,ICType as IC卡类,Name as 持卡人,UnLockSDate as 开锁时间 from alllockedrecord"
'CrystalReport1.ReportFileName = SystemDir & "lockprint.rpt"
ValidDate
End Sub
Private Sub LstRoomBook_Click()
If LstRoomBook.Text <> "" Then
TxtShortRoomNumber.Text = LstRoomBook.Text
LstRoomBook.Visible = False
End If
End Sub
Private Sub LstRoomBook_LostFocus()
LstRoomBook.Visible = False
End Sub
Private Sub TxtShortRoomNumber_KeyPress(KeyAscii As Integer)
Dim sSQL As String
Dim sDate1, sDate2 As String
If TxtShortRoomNumber <> "" And KeyAscii = 13 Then
sDate1 = TxtYear(0) & "年" & TxtMonth(0) & "月" & TxtDay(0) & "日" & "00:00:00"
sDate2 = TxtYear(1) & "年" & TxtMonth(1) & "月" & TxtDay(1) & "日" & "23:59:00"
sSQL = "Select * from alllockedrecord where unlocksdate>='" & sDate1 & "' and unlocksdate<='" & sDate2 & "' and shortroomnumber='" & Right("000000" & TxtShortRoomNumber.Text, 6) & "'"
Data1.RecordSource = sSQL
Data1.Refresh
End If
End Sub
Private Sub TxtYear_Change(Index As Integer)
Dim sTmp As String
sTmp = TxtYear(Index).Text
sTmp = "0000" & sTmp
If Mid(sTmp, Len(sTmp), 1) < "0" Or Mid(sTmp, Len(sTmp), 1) > "9" _
Or Mid(sTmp, Len(sTmp) - 1, 1) < "0" Or Mid(sTmp, Len(sTmp) - 1, 1) > "9" _
Or Mid(sTmp, Len(sTmp) - 2, 1) < "0" Or Mid(sTmp, Len(sTmp) - 2, 1) > "9" _
Or Mid(sTmp, Len(sTmp) - 3, 1) < "0" Or Mid(sTmp, Len(sTmp) - 3, 1) > "9" _
Then
MsgBox "日期年(2000以上数字)!", vbInformation + vbOKOnly, "提示"
TxtYear(Index).Text = Left(TxtYear(Index).Text, Len(TxtYear(Index).Text) - 1)
End If
End Sub
Private Sub TxtYear_LostFocus(Index As Integer)
If Val(TxtYear(Index).Text) < 2000 Then
TxtYear(Index).Text = "2000"
MsgBox "日期年(2000以上数字)!", vbInformation + vbOKOnly, "提示"
End If
End Sub
Private Sub TxtMonth_Change(Index As Integer)
Dim sTmp As String
sTmp = TxtMonth(Index).Text
sTmp = "00" & sTmp
If Mid(sTmp, Len(sTmp), 1) < "0" Or Mid(sTmp, Len(sTmp), 1) > "9" _
Or Mid(sTmp, Len(sTmp) - 1, 1) < "0" Or Mid(sTmp, Len(sTmp) - 1, 1) _
> "9" Or Val(sTmp) > 12 Then
MsgBox "日期月(00~12)输入错误!", vbInformation + vbOKOnly, "提示"
TxtMonth(Index).Text = Left(TxtMonth(Index).Text, Len(TxtMonth(Index).Text) - 1)
End If
End Sub
Private Sub TxtMonth_LostFocus(Index As Integer)
TxtMonth(Index).Text = Right("00" & Val(TxtMonth(Index).Text), 2)
End Sub
Private Sub TxtDay_Change(Index As Integer)
Dim sTmp As String
sTmp = TxtDay(Index).Text
sTmp = "00" & sTmp
If Mid(sTmp, Len(sTmp), 1) < "0" Or Mid(sTmp, Len(sTmp), 1) > "9" _
Or Mid(sTmp, Len(sTmp) - 1, 1) < "0" Or Mid(sTmp, Len(sTmp) - 1, 1) _
> "9" Or Val(sTmp) > 31 Then
MsgBox "日期(日00~31)输入错误!", vbInformation + vbOKOnly, "提示"
TxtDay(Index).Text = Left(TxtDay(Index).Text, Len(TxtDay(Index).Text) - 1)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -