?? editstud.frm
字號:
VERSION 5.00
Begin VB.Form Form3
BorderStyle = 1 'Fixed Single
Caption = "學生信息輸入"
ClientHeight = 3030
ClientLeft = 45
ClientTop = 330
ClientWidth = 4005
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form3"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3030
ScaleWidth = 4005
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 375
Left = 2880
TabIndex = 12
Top = 2520
Width = 975
End
Begin VB.CommandButton Command1
Caption = "保 存"
Height = 375
Left = 2880
TabIndex = 11
Top = 1920
Width = 975
End
Begin VB.TextBox Text5
Height = 375
Left = 1200
TabIndex = 4
Top = 2280
Width = 495
End
Begin VB.TextBox Text3
Height = 375
Left = 1200
TabIndex = 2
Top = 1320
Width = 1095
End
Begin VB.TextBox Text2
Height = 375
Left = 1200
TabIndex = 1
Top = 840
Width = 1335
End
Begin VB.TextBox Text1
Height = 375
Left = 1200
TabIndex = 0
Top = 360
Width = 1455
End
Begin VB.Frame Frame1
Caption = "學生情況"
Height = 2775
Left = 120
TabIndex = 5
Top = 120
Width = 2655
Begin VB.TextBox Text4
Height = 375
Left = 1080
TabIndex = 3
Top = 1680
Width = 1095
End
Begin VB.Label Label5
Caption = "借閱量"
Height = 375
Left = 240
TabIndex = 10
Top = 2280
Width = 735
End
Begin VB.Label Label4
Caption = "專業"
Height = 375
Left = 240
TabIndex = 9
Top = 1800
Width = 615
End
Begin VB.Label Label3
Caption = "班 級"
Height = 375
Left = 240
TabIndex = 8
Top = 1320
Width = 735
End
Begin VB.Label Label2
Caption = "姓 名"
Height = 375
Left = 240
TabIndex = 7
Top = 840
Width = 735
End
Begin VB.Label Label1
Caption = "學 號"
Height = 375
Left = 240
TabIndex = 6
Top = 360
Width = 735
End
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click() '確定
Dim result As Integer
Dim i, J As Integer
'排錯處理
If Text1.text = "" Then
result = MsgBox("學號欄空!", 48, "提示")
Exit Sub
End If
If Text2.text = "" Then
result = MsgBox("姓名欄空!", 48, "提示")
Exit Sub
End If
If Text3.text = "" Then
result = MsgBox("班級欄空!", 48, "提示")
Exit Sub
End If
If Text4.text = "" Then
result = MsgBox("專業欄空!", 48, "提示")
Exit Sub
End If
If Not IsNumeric(Text5.text) Then
result = MsgBox("請輸入借閱量!", 48, "提示")
Exit Sub
End If
'增加記錄時,檢驗關鍵字是否已存在
If flag2 = True Then
form2.Data1.Recordset.MoveLast
form2.Data1.Recordset.MoveFirst
For J = 1 To form2.Data1.Recordset.RecordCount
If form2.Data1.Recordset.Fields("學號") = Text1.text Then
result = MsgBox("此學號已存在,請重新輸入!", 48, "提示")
Exit Sub
End If
form2.Data1.Recordset.MoveNext
Next J
End If
If flag2 = True Then '添加新記錄
form2!Data1.Recordset.AddNew
Else '修改記錄
form2!Data1.Recordset.Edit
End If
'給各個字段賦值
form2.Data1.Recordset.Fields(0) = Text1.text
form2.Data1.Recordset.Fields(1) = Text2.text
form2.Data1.Recordset.Fields(2) = Text3.text
form2.Data1.Recordset.Fields(3) = Text4.text
form2.Data1.Recordset.Fields(4) = Text5.text
form2.Data1.Recordset.Update '更新記錄
form2.Data1.Refresh '更新數據庫
Unload Form3
End Sub
Private Sub Command2_Click() '退出
Unload Me
End Sub
Private Sub Form_Load() '裝載窗體
If flag2 = True Then
Text1.text = "" '添加操作時,對調入界面的初始化
Text2.text = ""
Text3.text = ""
Text4.text = ""
Text5.text = ""
Else
Text1.text = form2.Data1.Recordset.Fields(0) '修改操作時,對調入界面的初始化
Text2.text = form2.Data1.Recordset.Fields(1)
Text3.text = form2.Data1.Recordset.Fields(2)
Text4.text = form2.Data1.Recordset.Fields(3)
Text5.text = form2.Data1.Recordset.Fields(4)
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -