📄 frmfind.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form frmfind
BackColor = &H00FFC0C0&
Caption = "查询"
ClientHeight = 3645
ClientLeft = 60
ClientTop = 345
ClientWidth = 6615
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3645
ScaleWidth = 6615
StartUpPosition = 2 '屏幕中心
Begin MSComCtl2.DTPicker DTPicker2
Height = 255
Left = 1920
TabIndex = 13
Top = 2280
Width = 2655
_ExtentX = 4683
_ExtentY = 450
_Version = 393216
Format = 20054017
CurrentDate = 37999
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 255
Left = 1920
TabIndex = 12
Top = 1800
Width = 2655
_ExtentX = 4683
_ExtentY = 450
_Version = 393216
Format = 20054017
CurrentDate = 37999
End
Begin VB.ComboBox Combo2
Height = 300
Left = 1920
TabIndex = 11
Text = "账目名称"
Top = 3000
Width = 2655
End
Begin VB.OptionButton Option3
BackColor = &H00FFC0C0&
Caption = "按账目名称"
Height = 495
Left = 120
TabIndex = 10
Top = 2880
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
Index = 1
Left = 1920
TabIndex = 9
Text = "流水号"
Top = 840
Width = 2655
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 5280
TabIndex = 8
Top = 960
Width = 975
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 5280
TabIndex = 7
Top = 240
Width = 975
End
Begin VB.ComboBox Combo1
Height = 300
Index = 0
Left = 1920
TabIndex = 2
Text = "流水号"
Top = 240
Width = 2655
End
Begin VB.OptionButton Option2
BackColor = &H00FFC0C0&
Caption = "按日期查询"
Height = 255
Left = 120
TabIndex = 1
Top = 1800
Width = 1215
End
Begin VB.OptionButton Option1
BackColor = &H00FFC0C0&
Caption = "按流水号查询"
Height = 255
Left = 120
TabIndex = 0
Top = 240
Width = 1455
End
Begin VB.Label Label4
AutoSize = -1 'True
BackColor = &H00FFC0C0&
Caption = "到"
Height = 195
Left = 1680
TabIndex = 6
Top = 2280
Width = 180
End
Begin VB.Label Label3
AutoSize = -1 'True
BackColor = &H00FFC0C0&
Caption = "从"
Height = 195
Left = 1680
TabIndex = 5
Top = 1800
Width = 180
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00FFC0C0&
Caption = "到"
Height = 195
Left = 1680
TabIndex = 4
Top = 720
Width = 180
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00FFC0C0&
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 = DTPicker1.Value
find_date2 = DTPicker2.Value
sqlfind = "select * from 进出账 where 日期 between #" & _
find_date1 & "#" & " and" & " #" & find_date2 & "#"
End If
'按账目名称查询
If Option3.Value = True Then
sqlfind = "select * from 进出账 where 账目名称 = '" & Combo2.Text _
& "'"
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
Dim rs_kehuname As New ADODB.Recordset
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
sql = "select * from 账目名称"
rs_kehuname.CursorLocation = adUseClient
rs_kehuname.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_kehuname.EOF = False Then '添加账目名称
With rs_kehuname
Do While Not .EOF
Combo2.AddItem .Fields(0)
.MoveNext
Loop
End With
End If
rs_kehuname.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
rs_find.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -