?? fillfrm.frm
字號:
VERSION 5.00
Begin VB.Form Fillfrm
Caption = "選課退課表單"
ClientHeight = 4425
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4425
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton abortcmd
Caption = "放棄"
Height = 375
Left = 3120
TabIndex = 10
Top = 3840
Width = 1215
End
Begin VB.CommandButton withdrawcmd
Caption = "退課"
Height = 375
Left = 1680
TabIndex = 9
Top = 3840
Width = 1215
End
Begin VB.CommandButton submitcmd
Caption = "選課"
Height = 375
Left = 240
TabIndex = 8
Top = 3840
Width = 1095
End
Begin VB.TextBox courseIDtxt
Height = 375
Left = 1920
TabIndex = 7
Top = 2640
Width = 2415
End
Begin VB.TextBox courseNametxt
Height = 375
Left = 1920
TabIndex = 6
Top = 1800
Width = 2415
End
Begin VB.TextBox IDtxt
Height = 375
Left = 1920
TabIndex = 5
Top = 1080
Width = 2415
End
Begin VB.TextBox nametxt
Height = 375
Left = 1920
TabIndex = 4
Top = 240
Width = 2415
End
Begin VB.Label Label4
Caption = "課程編號:"
Height = 495
Left = 120
TabIndex = 3
Top = 2520
Width = 1455
End
Begin VB.Label Label3
Caption = "課程名稱:"
Height = 495
Left = 120
TabIndex = 2
Top = 1680
Width = 1455
End
Begin VB.Label Label2
Caption = "學號:"
Height = 495
Left = 120
TabIndex = 1
Top = 960
Width = 1455
End
Begin VB.Label Label1
Caption = "姓名:"
Height = 495
Left = 120
TabIndex = 0
Top = 120
Width = 1455
End
End
Attribute VB_Name = "Fillfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub abortcmd_Click()
Fillfrm.Hide
End Sub
Private Sub Form_Load()
With Fillfrm
.Top = Screen.Height / 2 - .Height / 2
.Left = Screen.width / 2 - .width / 2
End With
End Sub
Private Sub submitcmd_Click()
Dim rs As Recordset
Dim sqlstr As String
'打開"學號課程"表
Set rs = courseDB.OpenRecordset("學號課程", dbOpenDynaset)
sqlstr = "學號='" & IDtext & "'and 課程編號 = '" & courseIDtxt.Text & "'"
rs.FindFirst (sqlstr) '在學號課程表中查找該用戶是否已經選修了這么課程
If rs.NoMatch Then '如果沒有選修該門課程
'添加選課記錄到學號課程表中
With rs
.AddNew
!學號 = IDtxt.Text
!課程編號 = .LastModified
End With
MsgBox "選課成功", vbOKOnly
Fillfrm.Hide '如果已經選修了該門課程
Else
MsgBox "你已經選修了這門課程", vbOKOnly
Fillfrm.Hide
End If
'關閉記錄集
rs.Close
End Sub
Private Sub withdrawcmd_Click()
Dim rs As Recordset
Dim sqlstr As String
'打開"學號課程"表
Set rs = courseDB.OpenRecordset("學號課程", dbOpenDynaset)
sqlstr = "學號='" & IDtxtText & "'and 課程編號 = '" & courseIDtxt.Text & "'"
rs.FindFirst (sqlstr) '在學號課程表中查找高用戶是否已經選修了這門課程
If (Not rs.NoMatch) Then '如果已經選修了該門課程
RD.Delect
MgBox "退課成功", vbOKOnly
Fillfrm.Hide
Else '如果沒有選修該門課程
MsgBox "你沒有選修這門課程", vbOKOnly
Fillfrm.Hide
End If
'關閉記錄集
rs.Close
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -