📄 frmchaxun.frm
字号:
VERSION 5.00
Begin VB.Form frmfind
Caption = "查询输出"
ClientHeight = 3405
ClientLeft = 60
ClientTop = 450
ClientWidth = 6750
LinkTopic = "Form1"
ScaleHeight = 3405
ScaleWidth = 6750
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox Combo1
Height = 300
Index = 1
Left = 3600
TabIndex = 19
Top = 360
Width = 735
End
Begin VB.ComboBox Combo1
Height = 300
Index = 0
Left = 2400
TabIndex = 18
Top = 360
Width = 735
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3960
TabIndex = 17
Top = 2520
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 960
TabIndex = 16
Top = 2520
Width = 1215
End
Begin VB.ComboBox Combod
Height = 300
Index = 1
Left = 4800
TabIndex = 15
Top = 1920
Width = 735
End
Begin VB.ComboBox Combom
Height = 300
Index = 1
Left = 3600
TabIndex = 14
Top = 1920
Width = 735
End
Begin VB.ComboBox Comboy
Height = 300
Index = 1
Left = 2400
TabIndex = 10
Top = 1920
Width = 735
End
Begin VB.ComboBox Combod
Height = 300
Index = 0
Left = 4800
TabIndex = 7
Top = 1200
Width = 735
End
Begin VB.ComboBox Combom
Height = 300
Index = 0
Left = 3600
TabIndex = 5
Top = 1200
Width = 735
End
Begin VB.ComboBox Comboy
Height = 300
Index = 0
Left = 2400
TabIndex = 3
Top = 1200
Width = 735
End
Begin VB.OptionButton Option2
Caption = "按抵达日"
Height = 375
Left = 720
TabIndex = 1
Top = 1200
Width = 1095
End
Begin VB.OptionButton Option1
Caption = "按房号"
Height = 375
Left = 720
TabIndex = 0
Top = 360
Width = 975
End
Begin VB.Label Label2
Caption = "到"
Height = 375
Left = 3240
TabIndex = 21
Top = 360
Width = 375
End
Begin VB.Label Label1
Caption = "从"
Height = 375
Left = 2040
TabIndex = 20
Top = 360
Width = 255
End
Begin VB.Label Label10
Caption = "日"
Height = 255
Left = 5640
TabIndex = 13
Top = 1920
Width = 615
End
Begin VB.Label Label9
Caption = "月"
Height = 255
Left = 4440
TabIndex = 12
Top = 1920
Width = 495
End
Begin VB.Label Label8
Caption = "年"
Height = 255
Left = 3240
TabIndex = 11
Top = 1920
Width = 375
End
Begin VB.Label Label7
Caption = "到"
Height = 255
Left = 1920
TabIndex = 9
Top = 1920
Width = 495
End
Begin VB.Label Label6
Caption = "日"
Height = 255
Left = 5640
TabIndex = 8
Top = 1200
Width = 495
End
Begin VB.Label Label5
Caption = "月"
Height = 255
Left = 4440
TabIndex = 6
Top = 1200
Width = 495
End
Begin VB.Label Label4
Caption = "年"
Height = 255
Left = 3240
TabIndex = 4
Top = 1200
Width = 375
End
Begin VB.Label Label3
Caption = "从"
Height = 255
Left = 1920
TabIndex = 2
Top = 1200
Width = 375
End
End
Attribute VB_Name = "frmfind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs_find As New ADODB.Recordset
Private Sub Command1_Click()
On Error GoTo cmderror
Dim find_date1 As String
Dim find_date2 As String
If Option1.Value = True Then
sqlfind = "select * from 散客资料 where 房号 between '" & _
Combo1(0).Text & "'" & " and " & "'" & Combo1(1).Text & "'"
End If
If Option2.Value = True Then
find_date1 = Format(CDate(Comboy(0).Text & "-" & _
Combom(0).Text & "-" & Combod(0).Text), "yyyy-mm-dd")
find_date2 = Format(CDate(Comboy(1).Text & "-" & _
Combom(1).Text & "-" & Combod(1).Text), "yyyy-mm-dd")
sqlfind = "select * from 散客资料 where 抵达日 between #" & _
find_date1 & "#" & " and" & " #" & find_date2 & "#"
End If
rs_data1.Open sqlfind, conn, adOpenKeyset, adLockPessimistic
frmdatamanage.displaygrid1
Unload Me
cmderror:
If Err.Number <> 0 Then
MsgBox "请输入正确的查询条件!", vbOKOnly + vbExclamation, "警告"
End If
End Sub
Private Sub Command2_Click()
Unload Me
MDIForm1.Show
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim sql As String
'If findok = True Then
' rs_data1.Close
'End If
sql = "select * from 散客资料 order by 房号 desc"
rs_find.CursorLocation = adUseClient
rs_find.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_find.EOF = False Then '添加编号
With rs_find
Do While Not .EOF
Combo1(0).AddItem .Fields(0)
Combo1(1).AddItem .Fields(0)
.MoveNext
Loop
End With
End If
For i = 2001 To 2005 '添加年
Comboy(0).AddItem i
Comboy(1).AddItem i
Next i
For i = 1 To 12 '添加月
Combom(0).AddItem i
Combom(1).AddItem i
Next i
For i = 1 To 31 '添加日
Combod(0).AddItem i
Combod(1).AddItem i
Next i
End Sub
Private Sub Form_Unload(Cancel As Integer)
rs_find.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -