?? team.frm
字號:
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 7
Left = 240
TabIndex = 13
Top = 7080
Width = 975
End
Begin VB.Label Label2
Caption = "主場體育館"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 6
Left = 120
TabIndex = 12
Top = 6120
Width = 1215
End
Begin VB.Label Label2
Caption = "加入NBA年份"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 5
Left = 120
TabIndex = 11
Top = 5160
Width = 1335
End
Begin VB.Label Label2
Caption = "所在城市"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 4
Left = 240
TabIndex = 10
Top = 4200
Width = 975
End
Begin VB.Label Label2
Caption = "所在地區"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 3
Left = 240
TabIndex = 9
Top = 3360
Width = 975
End
Begin VB.Label Label2
Caption = "中譯名"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 2
Left = 360
TabIndex = 8
Top = 2520
Width = 735
End
Begin VB.Label Label2
Caption = "英文名"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 360
TabIndex = 7
Top = 1680
Width = 735
End
Begin VB.Label Label2
Caption = "ID"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 600
TabIndex = 6
Top = 840
Width = 375
End
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 2280
Top = 360
_ExtentX = 847
_ExtentY = 847
_Version = 393216
DialogTitle = "打開圖片"
Filter = "位圖|*.bmp|GIF圖片|*.gif|JPG圖片|*.jpg|所有圖片|*.*"
InitDir = "D:\我的文檔\My Pictures\logo"
End
Begin MSDBGrid.DBGrid DBGrid1
Bindings = "Team.frx":0000
Height = 9855
Left = 240
OleObjectBlob = "Team.frx":0014
TabIndex = 0
Top = 720
Width = 6975
End
Begin VB.Label Label1
Caption = "球隊列表"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 2
Top = 360
Width = 975
End
End
Attribute VB_Name = "TeamForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim ad As Boolean
Dim md As Boolean
Dim SJstr As String '升序或降序
Dim db As Database
Private Sub Combo2_Click()
On Error GoTo orderr
Data1.RecordSource = TeamSQLStr & " order by " & Combo2 & SJstr
Data1.Refresh
Exit Sub
orderr:
Data1.RecordSource = TeamSQLStr
MsgBox ("排序屬性選擇有誤!")
Data1.Refresh
End Sub
Private Sub Command1_Click()
If ad Then
On Error GoTo adderr
Command1.Caption = "添加"
Data1.Recordset.Update
Data1.Recordset.Bookmark = Data1.Recordset.LastModified
For i = 0 To 7
Text1(i).Locked = True
Next i
Text2.Locked = True
Image1.Enabled = False
Command2.Visible = True
DBGrid1.Enabled = True
ad = False
Else
For i = 0 To 7
Text1(i).Locked = False
Next i
Text2.Locked = False
Image1.Enabled = True
Command1.Caption = "確定"
Data1.Recordset.AddNew
Command2.Visible = False
DBGrid1.Enabled = False
ad = True
End If
Exit Sub
adderr:
MsgBox ("修改數據無效!")
Call Command3_Click
End Sub
Private Sub Command2_Click()
On Error GoTo mferr
If md Then
If Not judge() Then
MsgBox ("信息填寫有誤!")
Data1.Recordset.CancelUpdate
Else
Data1.Recordset.Update
Data1.Recordset.Bookmark = Data1.Recordset.LastModified
End If
md = False
For i = 0 To 7
Text1(i).Locked = True
Next i
Text2.Locked = True
Image1.Enabled = False
Command2.Caption = "修改"
Command1.Enabled = True
Else
For i = 0 To 7
Text1(i).Locked = False
Next i
Text2.Locked = False
Image1.Enabled = True
Data1.Recordset.Edit
md = True
Command2.Caption = "確認"
Command1.Enabled = False
End If
Exit Sub
mferr:
MsgBox ("修改數據無效!")
Call Command3_Click
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
If Command4.Caption = "降序" Then
Command4.Caption = "升序"
SJstr = " DESC"
Else
Command4.Caption = "降序"
SJstr = " ASC"
End If
Call Combo2_Click
End Sub
Private Sub Form_Load()
Dim rs As Recordset '記錄集變量
If dbpath = "" Then Unload Me
Data2.DatabaseName = dbpath
ad = False
md = False
Data1.DatabaseName = dbpath
'確定記錄集
If TeamSQLStr = "" Then
Data1.RecordSource = "Team"
Else
Data1.RecordSource = TeamSQLStr
End If
Text1(0).DataField = "ID"
Text1(1).DataField = "EName"
Text1(2).DataField = "CName"
Text1(3).DataField = "Section"
Text1(4).DataField = "City"
Text1(5).DataField = "Establish"
Text1(6).DataField = "Court"
Text1(7).DataField = "Contain"
Text2.DataField = "remark"
Image1.DataField = "Logo"
SJstr = " ASC" '初始升序
'處理排序表項
'打開DAO數據庫
Set db = OpenDatabase(dbpath)
'建立數據集
Set rs = db.OpenRecordset("Team")
For Each tbl In rs.Fields
Combo2.AddItem tbl.Name
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
If ad Then Data1.Recordset.CancelUpdate
If md Then Data1.Recordset.CancelUpdate
End Sub
Private Sub Image1_DblClick()
CommonDialog1.Action = 1
Image1.Picture = LoadPicture(CommonDialog1.FileName)
End Sub
Private Function judge() As Boolean
'判斷信息填寫是否正確
judge = True
If Val(Text1(0)) = 0 Then
judge = False
MsgBox ("ID輸入有誤!")
End If
If Val(Text1(1)) = 0 Then
judge = False
MsgBox ("姓名輸入有誤!")
End If
End Function
Private Sub Text1_Change(Index As Integer)
Select Case Index
Case 0
Dim SQLStr As String
SQLStr = "Select Coach.CName from Coach,Coach_Team where Team_ID=" & Text1(0) & " and Team_ID=ID"
Data2.RecordSource = SQLStr
Data2.Refresh
Combo1.Clear
Do Until Data2.Recordset.EOF
Combo1.AddItem Data2.Recordset.Fields(0)
Data2.Recordset.MoveNext
Loop
End Select
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -