?? form2.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Form2
Caption = "賽馬情況表"
ClientHeight = 5145
ClientLeft = 60
ClientTop = 345
ClientWidth = 7305
LinkTopic = "Form2"
MDIChild = -1 'True
ScaleHeight = 5145
ScaleWidth = 7305
ShowInTaskbar = 0 'False
Begin VB.Frame Frame2
Height = 3855
Left = 120
TabIndex = 9
Top = 1200
Width = 7095
Begin VB.CommandButton Command6
Caption = "刷 新"
Height = 375
Left = 4680
TabIndex = 13
Top = 3360
Width = 1335
End
Begin VB.CommandButton Command4
Caption = "添加記錄"
Height = 375
Left = 1560
TabIndex = 11
Top = 3360
Width = 1335
End
Begin VB.CommandButton Command5
Caption = "刪除記錄"
Height = 375
Left = 3120
TabIndex = 10
Top = 3360
Width = 1335
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 120
Top = 2880
Width = 6855
_ExtentX = 12091
_ExtentY = 661
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 MSDataGridLib.DataGrid DataGrid1
Height = 2775
Left = 120
TabIndex = 12
Top = 120
Width = 6855
_ExtentX = 12091
_ExtentY = 4895
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Begin VB.Frame Frame1
Height = 1215
Left = 120
TabIndex = 0
Top = 0
Width = 7095
Begin VB.ComboBox Combo2
Height = 300
ItemData = "Form2.frx":0000
Left = 1800
List = "Form2.frx":0031
TabIndex = 14
Text = "請選擇場次"
Top = 720
Width = 2175
End
Begin VB.TextBox Text1
Height = 375
Left = 720
TabIndex = 5
Top = 240
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "編號查詢"
Height = 375
Left = 2160
TabIndex = 4
Top = 240
Width = 975
End
Begin VB.CommandButton Command2
Caption = "顯 示"
Height = 375
Left = 4080
TabIndex = 3
Top = 720
Width = 975
End
Begin VB.TextBox Text3
Height = 375
Left = 4080
TabIndex = 2
Top = 240
Width = 1575
End
Begin VB.CommandButton Command3
Caption = "關健字查詢"
Height = 375
Left = 5760
TabIndex = 1
Top = 240
Width = 1215
End
Begin VB.Label Label1
Caption = "編號:"
Height = 255
Left = 120
TabIndex = 8
Top = 360
Width = 735
End
Begin VB.Label Label2
Caption = "顯示具體場次記錄:"
Height = 255
Left = 120
TabIndex = 7
Top = 840
Width = 1815
End
Begin VB.Label Label3
Caption = "關健字:"
Height = 255
Left = 3360
TabIndex = 6
Top = 360
Width = 735
End
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private rs As New ADODB.Recordset
Private strconn As String
Private strsql As String
Private str1 As String
Private str2 As String
Private str3 As String
Private flag As Integer
Private var1 As Variant
Private intctr As Integer
Private intj As Integer
Private xulang As Integer
Private rs3 As New ADODB.Recordset
Private strconn3 As String
Private strsql3 As String
Private s1 As String
Private s2 As String
Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
Adodc1.Caption = "當前記錄為:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
End Sub
Private Sub Command1_Click()
On Error Resume Next
str1 = "select 場次,編號,姓名,資料 from horse2 where 編號='" & Text1.Text & "'"
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\horse.mdb"
With rs
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = str1
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
Set DataGrid1.DataSource = rs
Set Adodc1.Recordset = rs
With DataGrid1
.Columns(0).Width = 1500
.Columns(1).Width = 1000
.Columns(2).Width = 1500
.Columns(3).Width = 1500
End With
Adodc1.Caption = "當前記錄為:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
End Sub
Private Sub Command2_Click()
On Error Resume Next
str1 = "select 場次,編號,姓名,資料 from horse2 where 場次='" & Combo2.Text & "'"
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\horse.mdb"
With rs
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = str1
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
Set DataGrid1.DataSource = rs
Set Adodc1.Recordset = rs
With DataGrid1
.Columns(0).Width = 1500
.Columns(1).Width = 1000
.Columns(2).Width = 1500
.Columns(3).Width = 1500
End With
Adodc1.Caption = "當前記錄為:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
End Sub
Private Sub Command3_Click()
On Error Resume Next
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\horse.mdb"
strsql = "select 場次,編號,姓名,資料 from horse2"
With rs
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = strsql
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
Set DataGrid1.DataSource = rs
Set Adodc1.Recordset = rs
With DataGrid1
.Columns(0).Width = 1500
.Columns(1).Width = 1000
.Columns(2).Width = 1500
.Columns(3).Width = 1500
End With
Adodc1.Caption = "當前記錄為:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
On Error Resume Next
If Form1.Command3.Caption = "關健字查詢" Then
rs.MoveFirst
Else
If (var1 + 1) < rs.RecordCount Or (var1 + 1) = rs.RecordCount Then
rs.Bookmark = var1 + 1
End If
End If
Do While Not rs.EOF
For intctr = 0 To rs.Fields.Count - 1
For intj = 1 To Len(rs(intctr))
If Mid(rs(intctr), intj, Len(Text3.Text)) = Text3.Text Then
'rs(intctr).Value.SetFocus
flag = 1
Form1.Command3.Caption = "查找下一個"
var1 = rs.Bookmark
Form2.DataGrid1.EditActive = True
Exit Do
End If
Next
Next
rs.MoveNext
Loop
If rs.EOF Then
Form1.Command3.Caption = "關健字查詢"
If flag = 0 Then
MsgBox "記錄沒有發現", , "查詢提示"
Else
MsgBox "已查找到最后", , "查詢提示"
End If
rs.MoveFirst
End If
End Sub
Private Sub Command4_Click()
Form4.Show
End Sub
Private Sub Command5_Click()
If MsgBox("確定要刪除記錄嗎?", vbYesNo, "刪除記錄") = vbYes Then
Form2.Adodc1.Recordset.Delete
End If
End Sub
Private Sub Command6_Click()
On Error Resume Next
Unload Me
Set rs = Nothing
Set rs3 = Nothing
Call Form_Load
End Sub
Private Sub Form_Activate()
MDIForm1.StatusBar1.SimpleText = "正在查閱... ...賽馬情況表"
End Sub
Private Sub Form_Load()
On Error Resume Next
Call xudi
xulang = 1
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\horse.mdb"
strsql = "select 場次,編號,姓名,資料 from horse2 order by flag2"
With rs
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = strsql
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
Set DataGrid1.DataSource = rs
Set Adodc1.Recordset = rs
If xulang = 1 Then
With DataGrid1
.Columns(0).Width = 1500
.Columns(1).Width = 1000
.Columns(2).Width = 1500
.Columns(3).Width = 1500
End With
End If
Adodc1.Caption = "當前記錄為:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
End Sub
Private Sub Form_Resize()
If Form2.WindowState = 0 Then
Form2.Width = 7425
Form2.Height = 5550
Form2.Frame1.Width = 7095
Form2.Frame2.Width = 7095
Form2.DataGrid1.Width = 6855
Form2.DataGrid1.Height = 2775
Form2.Frame2.Height = 3855
Form2.Adodc1.Top = 2880
Form2.Command4.Top = 3360
Form2.Command5.Top = 3360
Form2.Command6.Top = 3360
xulang = 1
End If
If Form2.WindowState = 2 Then
Form2.Frame1.Width = Form2.ScaleWidth - 200
Form2.Frame2.Width = Form2.ScaleWidth - 200
Form2.Adodc1.Top = Form2.Frame2.Height - 2000
Form2.Frame2.Height = Form2.ScaleHeight - Form2.Frame1.Height - 200
Form2.DataGrid1.Width = Form2.Frame2.Width - 200
Form2.DataGrid1.Height = Form2.Frame2.Height - 1320
Form2.Command4.Top = Form2.Frame2.Height - 600
Form2.Command5.Top = Form2.Frame2.Height - 600
Form2.Command6.Top = Form2.Frame2.Height - 600
Form2.Adodc1.Top = Form2.Frame2.Height - 1200
xulang = 2
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
MDIForm1.StatusBar1.SimpleText = ""
Set rs = Nothing
Set rs3 = Nothing
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -