📄 frmfind.frm
字号:
VERSION 5.00
Begin VB.Form frmfind
Caption = "查询"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 2 'CenterScreen
Begin VB.ComboBox combod
Height = 315
Index = 1
Left = 3720
TabIndex = 15
Text = "日"
Top = 1440
Width = 615
End
Begin VB.ComboBox combom
Height = 315
Index = 1
Left = 2760
TabIndex = 14
Text = "月"
Top = 1440
Width = 615
End
Begin VB.ComboBox comboy
Height = 315
Index = 1
Left = 1680
TabIndex = 13
Text = "年"
Top = 1440
Width = 855
End
Begin VB.ComboBox Combo1
Height = 315
Index = 1
Left = 3480
TabIndex = 12
Text = "流水号"
Top = 240
Width = 975
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2880
TabIndex = 11
Top = 2280
Width = 975
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 960
TabIndex = 10
Top = 2280
Width = 975
End
Begin VB.ComboBox combod
Height = 315
Index = 0
Left = 3720
TabIndex = 9
Text = "日"
Top = 960
Width = 615
End
Begin VB.ComboBox combom
Height = 315
Index = 0
Left = 2760
TabIndex = 8
Text = "月"
Top = 960
Width = 615
End
Begin VB.ComboBox comboy
Height = 315
Index = 0
Left = 1680
TabIndex = 7
Text = "年"
Top = 960
Width = 855
End
Begin VB.ComboBox Combo1
Height = 315
Index = 0
Left = 1920
TabIndex = 2
Text = "流水号"
Top = 240
Width = 975
End
Begin VB.OptionButton Option2
Caption = "按日期查询"
Height = 255
Left = 120
TabIndex = 1
Top = 960
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "按流水号查询"
Height = 255
Left = 120
TabIndex = 0
Top = 240
Width = 1455
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "日"
Height = 195
Left = 4440
TabIndex = 21
Top = 960
Width = 180
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "日"
Height = 195
Left = 4440
TabIndex = 20
Top = 1440
Width = 180
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "月"
Height = 195
Left = 3480
TabIndex = 19
Top = 1440
Width = 180
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "月"
Height = 195
Left = 3480
TabIndex = 18
Top = 960
Width = 180
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "年"
Height = 195
Left = 2520
TabIndex = 17
Top = 1440
Width = 180
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "年"
Height = 195
Left = 2520
TabIndex = 16
Top = 960
Width = 180
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "到"
Height = 195
Left = 1440
TabIndex = 6
Top = 1440
Width = 180
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "从"
Height = 195
Left = 1440
TabIndex = 5
Top = 960
Width = 180
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "到"
Height = 195
Left = 3240
TabIndex = 4
Top = 240
Width = 180
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "从"
Height = 195
Left = 1680
TabIndex = 3
Top = 240
Width = 180
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 Err.Description
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim j 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 = 1999 To 2003 '添加年
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 + -