📄 chaxun.frm
字号:
VERSION 5.00
Begin VB.Form chaxun
BackColor = &H00FFFFC0&
Caption = "查询"
ClientHeight = 5190
ClientLeft = 60
ClientTop = 345
ClientWidth = 6780
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5190
ScaleWidth = 6780
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame2
BackColor = &H00FFFFC0&
Caption = "选择2"
Height = 1455
Left = 360
TabIndex = 8
Top = 2160
Width = 5295
Begin VB.OptionButton Option2
BackColor = &H00FFFFC0&
Caption = "按日期查询"
Height = 255
Left = 120
TabIndex = 15
Top = 360
Width = 1215
End
Begin VB.ComboBox comboy
BackColor = &H00FFFFFF&
Height = 300
Index = 0
Left = 1680
TabIndex = 14
Text = "年"
Top = 360
Width = 855
End
Begin VB.ComboBox combom
BackColor = &H00FFFFFF&
Height = 300
Index = 0
Left = 2760
TabIndex = 13
Text = "月"
Top = 360
Width = 615
End
Begin VB.ComboBox combod
BackColor = &H00FFFFFF&
Height = 300
Index = 0
Left = 3720
TabIndex = 12
Text = "日"
Top = 360
Width = 615
End
Begin VB.ComboBox comboy
BackColor = &H00FFFFFF&
Height = 300
Index = 1
Left = 1680
TabIndex = 11
Text = "年"
Top = 840
Width = 855
End
Begin VB.ComboBox combom
BackColor = &H00FFFFFF&
Height = 300
Index = 1
Left = 2760
TabIndex = 10
Text = "月"
Top = 840
Width = 615
End
Begin VB.ComboBox combod
BackColor = &H00FFFFFF&
Height = 300
Index = 1
Left = 3720
TabIndex = 9
Text = "日"
Top = 840
Width = 615
End
Begin VB.Label Label3
AutoSize = -1 'True
BackColor = &H00FFFFC0&
Caption = "从"
Height = 195
Left = 1440
TabIndex = 23
Top = 360
Width = 180
End
Begin VB.Label Label4
AutoSize = -1 'True
BackColor = &H00FFFFC0&
Caption = "到"
Height = 195
Left = 1440
TabIndex = 22
Top = 840
Width = 180
End
Begin VB.Label Label5
AutoSize = -1 'True
BackColor = &H00FFFFC0&
Caption = "年"
Height = 195
Left = 2520
TabIndex = 21
Top = 360
Width = 180
End
Begin VB.Label Label6
AutoSize = -1 'True
BackColor = &H00FFFFC0&
Caption = "年"
Height = 195
Left = 2520
TabIndex = 20
Top = 840
Width = 180
End
Begin VB.Label Label7
AutoSize = -1 'True
BackColor = &H00FFFFC0&
Caption = "月"
Height = 195
Left = 3480
TabIndex = 19
Top = 360
Width = 180
End
Begin VB.Label Label8
AutoSize = -1 'True
BackColor = &H00FFFFC0&
Caption = "月"
Height = 195
Left = 3480
TabIndex = 18
Top = 840
Width = 180
End
Begin VB.Label Label9
AutoSize = -1 'True
BackColor = &H00FFFFC0&
Caption = "日"
Height = 195
Left = 4440
TabIndex = 17
Top = 840
Width = 180
End
Begin VB.Label Label10
AutoSize = -1 'True
BackColor = &H00FFFFC0&
Caption = "日"
Height = 195
Left = 4440
TabIndex = 16
Top = 360
Width = 180
End
End
Begin VB.Frame Frame1
BackColor = &H00FFFFC0&
Caption = "选择1"
Height = 1335
Left = 360
TabIndex = 2
Top = 360
Width = 5175
Begin VB.OptionButton Option1
BackColor = &H00FFFFC0&
Caption = "按货单号查询"
Height = 255
Left = 120
TabIndex = 5
Top = 480
Value = -1 'True
Width = 1455
End
Begin VB.ComboBox Combo1
BackColor = &H00FFFFFF&
Height = 300
Index = 0
Left = 1800
TabIndex = 4
Text = "货单号"
Top = 480
Width = 975
End
Begin VB.ComboBox Combo1
BackColor = &H00FFFFFF&
Height = 300
Index = 1
Left = 3480
TabIndex = 3
Text = "货单号"
Top = 480
Width = 975
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00FFFFC0&
Caption = "从"
Height = 195
Left = 1560
TabIndex = 7
Top = 480
Width = 180
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00FFFFC0&
Caption = "到"
Height = 195
Left = 3120
TabIndex = 6
Top = 480
Width = 180
End
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3960
TabIndex = 1
Top = 3840
Width = 975
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 1200
TabIndex = 0
Top = 3840
Width = 975
End
Begin VB.Line Line2
X1 = 0
X2 = 5880
Y1 = 3720
Y2 = 3720
End
Begin VB.Line Line1
X1 = 0
X2 = 5880
Y1 = 1920
Y2 = 1920
End
End
Attribute VB_Name = "chaxun"
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
kumanage.displaygrid1
Unload Me
kumanage.Show
cmderror:
If Err.Number <> 0 Then
MsgBox "请输入正确的查询条件!", vbOKOnly + vbExclamation, "警告"
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 = 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
Private Sub Option1_Click()
Option2.Value = False
End Sub
Private Sub Option2_Click()
Option1.Value = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -