📄 frmfind.frm
字号:
VERSION 5.00
Begin VB.Form frmfind
BackColor = &H00C0FFC0&
Caption = "查询输出"
ClientHeight = 4110
ClientLeft = 60
ClientTop = 450
ClientWidth = 7095
Icon = "frmfind.frx":0000
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 4110
ScaleWidth = 7095
Begin VB.CommandButton Command2
Caption = "取消"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4560
TabIndex = 21
Top = 2400
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "查询"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1680
TabIndex = 20
Top = 2400
Width = 1335
End
Begin VB.ComboBox Combod
BackColor = &H80000018&
Height = 300
Index = 1
Left = 5400
TabIndex = 18
Top = 1680
Width = 855
End
Begin VB.ComboBox Combom
BackColor = &H80000018&
Height = 300
Index = 1
Left = 3960
TabIndex = 16
Top = 1680
Width = 975
End
Begin VB.ComboBox Comboy
BackColor = &H80000018&
Height = 300
Index = 1
Left = 2640
TabIndex = 14
Top = 1680
Width = 855
End
Begin VB.ComboBox Combod
BackColor = &H80000018&
Height = 300
Index = 0
Left = 5400
TabIndex = 11
Top = 1320
Width = 855
End
Begin VB.ComboBox Combom
BackColor = &H80000018&
Height = 300
Index = 0
Left = 3960
TabIndex = 9
Top = 1320
Width = 975
End
Begin VB.ComboBox Comboy
BackColor = &H80000018&
Height = 300
Index = 0
Left = 2640
TabIndex = 7
Top = 1320
Width = 855
End
Begin VB.ComboBox Combol
BackColor = &H80000018&
Height = 300
Index = 1
Left = 3960
TabIndex = 5
Top = 960
Width = 975
End
Begin VB.ComboBox Combol
BackColor = &H80000018&
Height = 300
Index = 0
Left = 2640
TabIndex = 3
Top = 960
Width = 855
End
Begin VB.OptionButton Option2
Caption = "按购买日期查询"
Height = 375
Left = 720
TabIndex = 1
Top = 1560
Width = 1455
End
Begin VB.OptionButton Option1
Caption = "按编号查询"
Height = 375
Left = 720
TabIndex = 0
Top = 960
Width = 1455
End
Begin VB.Line Line4
BorderColor = &H00FF0000&
X1 = 600
X2 = 6720
Y1 = 3000
Y2 = 3000
End
Begin VB.Line Line3
BorderColor = &H00FF0000&
X1 = 6720
X2 = 6720
Y1 = 840
Y2 = 3000
End
Begin VB.Line Line2
BorderColor = &H00FF0000&
X1 = 600
X2 = 600
Y1 = 840
Y2 = 3000
End
Begin VB.Line Line1
BorderColor = &H00FF0000&
X1 = 600
X2 = 6720
Y1 = 840
Y2 = 840
End
Begin VB.Label Label11
BackColor = &H00C0C0FF&
Caption = "请选择查询方式:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 735
Left = 960
TabIndex = 22
Top = 120
Width = 5415
End
Begin VB.Label Label10
Caption = "日"
Height = 255
Left = 6360
TabIndex = 19
Top = 1680
Width = 255
End
Begin VB.Label Label9
Caption = "月"
Height = 255
Left = 5040
TabIndex = 17
Top = 1680
Width = 255
End
Begin VB.Label Label8
Caption = "年"
Height = 255
Left = 3600
TabIndex = 15
Top = 1680
Width = 255
End
Begin VB.Label Label7
Caption = "到"
Height = 255
Left = 2280
TabIndex = 13
Top = 1680
Width = 255
End
Begin VB.Label Label6
Caption = "日"
Height = 255
Left = 6360
TabIndex = 12
Top = 1320
Width = 255
End
Begin VB.Label Label5
Caption = "月"
Height = 255
Left = 5040
TabIndex = 10
Top = 1320
Width = 255
End
Begin VB.Label Label4
Caption = "年"
Height = 255
Left = 3600
TabIndex = 8
Top = 1320
Width = 255
End
Begin VB.Label Label3
Caption = "从"
Height = 255
Left = 2280
TabIndex = 6
Top = 1320
Width = 255
End
Begin VB.Label Label2
Caption = "到"
Height = 255
Left = 3600
TabIndex = 4
Top = 960
Width = 255
End
Begin VB.Label Label1
Caption = "从"
Height = 255
Left = 2280
TabIndex = 2
Top = 960
Width = 255
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 '" & Combol(0).Text & "'" & "and" & "'" & Combol(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
kufangguanli.displaygrid1
Unload Me
cmderror:
If Err.Number <> 0 Then
MsgBox Err.Description
End If
End Sub
Private Sub Command2_Click()
frmfind.Hide
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
Combol(0).AddItem .Fields(0)
Combol(1).AddItem .Fields(0)
.MoveNext
Loop
End With
End If
For i = 1900 To 2055
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -