📄 edstud1.frm
字号:
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Index = 3
Left = 540
TabIndex = 18
Top = 3075
Width = 825
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "学 号*"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Index = 5
Left = 540
TabIndex = 17
Top = 540
Width = 825
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "出生日期"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Index = 9
Left = 450
TabIndex = 16
Top = 1545
Width = 915
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "<-日期格式:yy-mm-dd"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 2910
TabIndex = 13
Top = 1560
Width = 2235
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "姓 名*"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Index = 0
Left = 540
TabIndex = 12
Top = 1050
Width = 825
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "籍 贯"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Index = 1
Left = 555
TabIndex = 11
Top = 2040
Width = 705
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "专 业*"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Index = 2
Left = 555
TabIndex = 10
Top = 2550
Width = 825
End
End
Begin VB.CommandButton comm1
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 510
Left = 2010
TabIndex = 7
Top = 3870
Width = 960
End
Begin VB.CommandButton comm2
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 510
Left = 3495
TabIndex = 8
Top = 3870
Width = 960
End
End
Attribute VB_Name = "edstud1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
If flag = 2 Then '修改操作
Text1(0).Text = Trim(edstud.Adodc1.Recordset.Fields("学号"))
Text1(1).Text = Trim(edstud.Adodc1.Recordset.Fields("姓名")) & ""
If edstud.Adodc1.Recordset.Fields("性别") = "男" Then
Opt1.Value = True
ElseIf edstud.Adodc1.Recordset.Fields("性别") = "女" Then
Opt2.Value = True
End If
Text1(2).Text = Trim(edstud.Adodc1.Recordset.Fields("出生日期")) & ""
Text1(3).Text = Trim(edstud.Adodc1.Recordset.Fields("籍贯")) & ""
DataCombo1.Text = Trim(edstud.Adodc1.Recordset.Fields("专业")) & ""
DataCombo2.Text = Trim(edstud.Adodc1.Recordset.Fields("班号")) & ""
End If
DataCombo2.Enabled = False
End Sub
Private Sub Comm1_Click()
If Trim(Text1(0).Text) = "" Or Trim(Text1(1).Text) = "" Or Trim(DataCombo1.Text) = "" Or Trim(DataCombo2.Text) = "" Then
MsgBox "加*数据项不能为空,请重新设置", vbOKOnly, "信息提示"
Text1(0).SetFocus
Exit Sub
End If
If Trim(Text1(2).Text) <> "" Then
If Not IsDate(Trim(Text1(2).Text)) Then
MsgBox "出生日期输入不正确,重新输入", vbOKOnly, "信息提示"
Text1(2).SetFocus
Exit Sub
End If
End If
If flag = 1 Then '添加操作
recs = recs + 1
edstud.Adodc1.Recordset.AddNew
End If
edstud.Adodc1.Recordset.Fields("学号") = Trim(Text1(0).Text)
edstud.Adodc1.Recordset.Fields("姓名") = Trim(Text1(1).Text)
If Opt1.Value = True Then
edstud.Adodc1.Recordset.Fields("性别") = "男"
ElseIf Opt2.Value = True Then
edstud.Adodc1.Recordset.Fields("性别") = "女"
Else
edstud.Adodc1.Recordset.Fields("性别") = ""
End If
If Trim(Text1(2).Text) <> "" Then
edstud.Adodc1.Recordset.Fields("出生日期") = Format(Trim(Text1(2).Text), "yyyy-mm-dd")
End If
edstud.Adodc1.Recordset.Fields("籍贯") = Trim(Text1(3).Text)
edstud.Adodc1.Recordset.Fields("专业") = Trim(DataCombo1.Text)
edstud.Adodc1.Recordset.Fields("班号") = Trim(DataCombo2.Text)
edstud.Adodc1.Recordset.Update
Unload Me
End Sub
Private Sub Comm2_Click()
Unload Me
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
Call endata(KeyAscii)
End Sub
Private Sub DataCombo1_Click(Area As Integer)
DataCombo2.Enabled = True
End Sub
Private Sub DataCombo1_LostFocus()
If Trim(DataCombo1.Text) <> "" Then
Adodc2.RecordSource = "select * from classn where 专业='" + Trim(DataCombo1.Text) + "'"
Adodc2.Refresh
End If
End Sub
Private Sub DataCombo2_GotFocus()
If Trim(DataCombo1.Text) = "" Then
MsgBox "先从专业组合框中选择一个专业", vbOKOnly, "信息提示"
DataCombo2.Enabled = False
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -