?? frmfind.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmfind
Caption = "車輛總匯"
ClientHeight = 4260
ClientLeft = 60
ClientTop = 450
ClientWidth = 6930
LinkTopic = "Form1"
ScaleHeight = 4260
ScaleWidth = 6930
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 240
Top = 3840
Visible = 0 'False
Width = 1335
_ExtentX = 2355
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3720
TabIndex = 20
Top = 3360
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "查詢"
Height = 375
Left = 1080
TabIndex = 19
Top = 3360
Width = 1095
End
Begin VB.ComboBox Combod
Height = 300
Index = 1
Left = 5640
TabIndex = 16
Top = 2640
Width = 735
End
Begin VB.ComboBox Combom
Height = 300
Index = 1
Left = 4440
TabIndex = 13
Top = 2640
Width = 735
End
Begin VB.ComboBox Comboy
Height = 300
Index = 1
Left = 3120
TabIndex = 12
Top = 2640
Width = 855
End
Begin VB.ComboBox Combod
Height = 300
Index = 0
Left = 5640
TabIndex = 10
Top = 1680
Width = 735
End
Begin VB.ComboBox Combom
Height = 300
Index = 0
Left = 4440
TabIndex = 8
Top = 1680
Width = 735
End
Begin VB.ComboBox Comboy
Height = 300
Index = 0
Left = 3000
TabIndex = 6
Top = 1680
Width = 855
End
Begin VB.ComboBox Combo2
Height = 300
Left = 3000
TabIndex = 4
Top = 1200
Visible = 0 'False
Width = 1695
End
Begin VB.ComboBox Combo1
Height = 300
Left = 3000
TabIndex = 3
Top = 480
Width = 1695
End
Begin VB.OptionButton Option3
Caption = "按日期查詢"
Height = 255
Left = 720
TabIndex = 2
Top = 1560
Width = 1695
End
Begin VB.OptionButton Option2
Caption = "按顏色查詢"
Height = 255
Left = 720
TabIndex = 1
Top = 1200
Visible = 0 'False
Width = 1695
End
Begin VB.OptionButton Option1
Caption = "按名稱查詢"
Height = 255
Left = 720
TabIndex = 0
Top = 480
Width = 1815
End
Begin VB.Label Label11
Caption = "日"
Height = 255
Left = 6480
TabIndex = 18
Top = 2640
Width = 375
End
Begin VB.Label Label10
Caption = "月"
Height = 255
Left = 5280
TabIndex = 17
Top = 2640
Width = 375
End
Begin VB.Label Label9
Caption = "年"
Height = 375
Left = 4080
TabIndex = 15
Top = 2640
Width = 375
End
Begin VB.Label Label8
Caption = "到"
Height = 255
Left = 2760
TabIndex = 14
Top = 2640
Width = 375
End
Begin VB.Label Label7
Caption = "日"
Height = 375
Left = 6480
TabIndex = 11
Top = 1920
Width = 495
End
Begin VB.Label Label6
Caption = "月"
Height = 255
Left = 5280
TabIndex = 9
Top = 1680
Width = 375
End
Begin VB.Label Label5
Caption = "年"
Height = 255
Left = 4080
TabIndex = 7
Top = 1680
Width = 375
End
Begin VB.Label Label4
Caption = "從"
Height = 375
Left = 2760
TabIndex = 5
Top = 1680
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 車輛名稱='" & Me.Combo1.Text & "'"
End If
If Option3.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.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
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -