?? frmchaxun.frm
字號:
VERSION 5.00
Begin VB.Form frmfind
Caption = "查詢輸出"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 450
ClientWidth = 5730
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 5730
StartUpPosition = 3 '窗口缺省
Begin VB.OptionButton Option1
Caption = "按入庫單號"
Height = 375
Left = 360
TabIndex = 15
Top = 240
Width = 1575
End
Begin VB.ComboBox Combo1
Height = 300
Index = 1
Left = 3120
TabIndex = 10
Top = 360
Width = 735
End
Begin VB.ComboBox Combo1
Height = 300
Index = 0
Left = 1920
TabIndex = 9
Top = 360
Width = 735
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3720
TabIndex = 8
Top = 2400
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "查詢"
Height = 375
Left = 1080
TabIndex = 7
Top = 2400
Width = 1215
End
Begin VB.ComboBox Combod
Height = 300
Index = 1
Left = 4200
TabIndex = 6
Top = 1680
Width = 735
End
Begin VB.ComboBox Combom
Height = 300
Index = 1
Left = 3000
TabIndex = 5
Top = 1680
Width = 735
End
Begin VB.ComboBox Comboy
Height = 300
Index = 1
Left = 1920
TabIndex = 4
Top = 1680
Width = 735
End
Begin VB.ComboBox Combod
Height = 300
Index = 0
Left = 4200
TabIndex = 3
Top = 1080
Width = 735
End
Begin VB.ComboBox Combom
Height = 300
Index = 0
Left = 3000
TabIndex = 2
Top = 1080
Width = 735
End
Begin VB.ComboBox Comboy
Height = 300
Index = 0
Left = 1920
TabIndex = 1
Top = 1080
Width = 735
End
Begin VB.OptionButton Option2
Caption = "按日期"
Height = 375
Left = 360
TabIndex = 0
Top = 960
Width = 1695
End
Begin VB.Label Label8
Caption = "日"
Height = 255
Left = 5040
TabIndex = 19
Top = 1680
Width = 375
End
Begin VB.Label Label7
Caption = "月"
Height = 375
Left = 3840
TabIndex = 18
Top = 1680
Width = 255
End
Begin VB.Label Label6
Caption = "年"
Height = 255
Left = 2760
TabIndex = 17
Top = 1680
Width = 255
End
Begin VB.Label Label5
Caption = "到"
Height = 375
Left = 1440
TabIndex = 16
Top = 1680
Width = 375
End
Begin VB.Label Label3
Caption = "月"
Height = 255
Left = 3840
TabIndex = 14
Top = 1080
Width = 375
End
Begin VB.Label Label4
Caption = "日"
Height = 255
Left = 5040
TabIndex = 13
Top = 1080
Width = 255
End
Begin VB.Label Label2
Caption = "年"
Height = 375
Left = 2760
TabIndex = 12
Top = 1080
Width = 375
End
Begin VB.Label Label1
Caption = "到"
Height = 255
Left = 2760
TabIndex = 11
Top = 360
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
Option1.Value = True
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 + -