📄 frmview.frm
字号:
TabIndex = 25
Top = 1200
Width = 1095
End
Begin VB.Label Label1
Caption = "家庭地址:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 3
Left = 480
TabIndex = 24
Top = 1560
Width = 1095
End
Begin VB.Label Label1
Caption = "所在城市:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 4
Left = 480
TabIndex = 23
Top = 1920
Width = 1095
End
Begin VB.Label Label1
Caption = "省份:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 5
Left = 480
TabIndex = 22
Top = 2280
Width = 1095
End
Begin VB.Label Label1
Caption = "邮政编码:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 6
Left = 480
TabIndex = 21
Top = 2640
Width = 1095
End
Begin VB.Label Label1
Caption = "电话号码:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 7
Left = 480
TabIndex = 20
Top = 3000
Width = 1095
End
Begin VB.Label Label1
Caption = "电子邮件:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 8
Left = 480
TabIndex = 19
Top = 3360
Width = 1095
End
Begin VB.Label Label1
Caption = "主修:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 9
Left = 480
TabIndex = 18
Top = 3720
Width = 1095
End
Begin VB.Label Label1
Caption = "学号:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 10
Left = 480
TabIndex = 17
Top = 4080
Width = 1095
End
Begin VB.Label Label1
Caption = "附注:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 11
Left = 480
TabIndex = 16
Top = 4440
Width = 1095
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 120
Top = 6240
Width = 2640
_ExtentX = 4657
_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 = ""
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 Command3
Caption = "关闭(&C)"
Height = 375
Left = 5640
TabIndex = 2
Top = 6240
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "查找(&F)..."
Height = 375
Left = 4320
TabIndex = 1
Top = 6240
Width = 1215
End
Begin VB.Line Line2
BorderColor = &H00FFFFFF&
X1 = 120
X2 = 6840
Y1 = 370
Y2 = 370
End
Begin VB.Line Line1
X1 = 120
X2 = 6840
Y1 = 360
Y2 = 360
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "学生:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Index = 0
Left = 120
TabIndex = 0
Top = 120
Width = 2055
End
End
Attribute VB_Name = "FrmView"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim position As Integer
Private Sub Command1_Click()
On Error GoTo errh
DlgSearch.Show (1)
If searchSQL <> "" Then
Adodc1.RecordSource = searchSQL
Adodc1.Refresh
SSTab1.Tab = 0
Exit Sub
End If
errh:
MsgBox Err.Description
End Sub
Private Sub Command2_Click()
On Error GoTo errh
Select Case SSTab1.Caption
Case "学生基本情况"
Adodc1.Recordset.AddNew
Case "成绩"
Case "课程设置"
DataGrid2.AllowAddNew = True
End Select
Exit Sub
errh:
MsgBox Err.Description
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
On Error GoTo errh
Adodc1.Recordset.Update
Exit Sub
errh:
MsgBox Err.Description
End Sub
Private Sub Command5_Click()
searchSQL = "SELECT * FROM 学生"
On Error GoTo errh
Adodc1.RecordSource = searchSQL
Adodc1.Refresh
Exit Sub
errh:
MsgBox Err.Description
End Sub
Private Sub Form_Load()
On Error GoTo errh
MakeCenter FrmView
If UserType = False Then
Adodc1.Mode = adModeRead
DataGrid1.AllowUpdate = False
DataGrid2.AllowUpdate = False
Command2.Enabled = False
Command4.Enabled = False
Dim chgcontrol As Control
For Each chgcontrol In Controls
If TypeOf chgcontrol Is TextBox Then
chgcontrol.Locked = True
End If
Next chgcontrol
Else
Adodc1.Mode = adModeUnknown
End If
position = 0
Adodc1.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=学籍.MDB;" & _
"DefaultDir=" & CheckPath(App.path) & ";" & _
"UID=;PWD=;" & _
"PASSWORD=197967yh"
Adodc1.RecordSource = searchSQL
Text1.DataField = "学号"
Text2.DataField = "姓名"
Text3.DataField = "性别"
Text4.DataField = "出生日期"
Text5.DataField = "民族"
Text6.DataField = "地址"
Text7.DataField = "邮政编码"
Text8.DataField = "电话号码"
Text9.DataField = "院系"
Text10.DataField = "专业"
'Text11.DataField = "学号"
Text11.DataField = "附注"
SSTab1.Tab = 0
Exit Sub
errh:
MsgBox Err.Description
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Adodc1.Recordset.Close
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
On Error GoTo errh
If position <> 0 Then
Select Case SSTab1.Caption
Case "学生基本情况"
Adodc1.RecordSource = searchSQL
Adodc1.Refresh
Case "成绩"
Adodc1.RecordSource = "SELECT 学生和课程.学生课程ID,课程.课程ID,课程.课程名称,学生和课程.成绩,课程.授课老师 FROM 学生,学生和课程,课程 WHERE 学生.学生ID=" & position & "AND 学生和课程.学生ID=" & position & "AND 课程.课程ID=学生和课程.课程ID"
Adodc1.Refresh
DataGrid1.ReBind
Case "课程设置"
Adodc1.RecordSource = "SELECT * FROM 课程"
Adodc1.Refresh
DataGrid2.ReBind
End Select
End If
Exit Sub
errh:
MsgBox Err.Description
End Sub
Private Sub Text11_Change()
If Adodc1.Recordset.EOF Then Exit Sub
If Adodc1.Recordset.BOF Then Exit Sub
position = Adodc1.Recordset.Fields("学生ID").Value
Label1(0).Caption = Text1.Text
End Sub
Private Sub Text2_GotFocus()
If Text2.Text = "" Then
If Text1.Text <> "" Then
Text2.Text = Left$(Text1.Text, 1)
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -