If Not Testtxt(comboGrade.Text) Then
MsgBox "请选择年级!", vbOKOnly + vbExclamation, "警告"
comboGrade.SetFocus
Exit Sub
End If
If Not Testtxt(txtDirector.Text) Then
MsgBox "请输入班主任姓名!", vbOKOnly + vbExclamation, "警告"
txtDirector.SetFocus
Exit Sub
End If
If Not Testtxt(txtClassroom.Text) Then
MsgBox "请输入教室房间号!", vbOKOnly + vbExclamation, "警告"
txtClassroom.SetFocus
Exit Sub
End If
If Not IsNumeric(Trim(txtClassno.Text)) Then
MsgBox "请输入数字!", vbOKOnly + vbExclamation, "警告"
Exit Sub
txtClassno.SetFocus
End If
txtSQL = "select * from class_Info "
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.MoveFirst
While (mrc.EOF = False)
If (Trim(mrc.Fields(0)) = Trim(txtClassno.Text)) Then
MsgBox "班号已经存在,请重新输入班号!", vbOKOnly + vbExclamation, "警告"
Exit Sub
txtClassno.Text = ""
txtClassno.SetFocus
Else
mrc.MoveNext
End If
Wend
mrc.AddNew
mrc.Fields(0) = Trim(txtClassno.Text)
mrc.Fields(1) = Trim(comboGrade.Text)
mrc.Fields(2) = Trim(txtDirector.Text)
mrc.Fields(3) = Trim(txtClassroom.Text)
mrc.Update
mrc.Close
MsgBox "添加班级信息成功!", vbOKOnly + vbExclamation, "添加班级信息"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
comboGrade.AddItem "初中一年级"
comboGrade.AddItem "初中二年级"
comboGrade.AddItem "初中三年级"
comboGrade.AddItem "高中一年级"
comboGrade.AddItem "高中二年级"
comboGrade.AddItem "高中三年级"
End Sub
.........................................................................................................
............................ frmAddcourseinfo 添加课程信息窗口代码 ...............................
Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim txtSQL As String
If Not Testtxt(txtCourseno.Text) Then
MsgBox "请输入课程编号!", vbOKOnly + vbExclamation, "警告"
txtCourseno.SetFocus
Exit Sub
End If
If Not Testtxt(txtCoursename.Text) Then
MsgBox "请输入课程名称!", vbOKOnly + vbExclamation, "警告"
txtCoursename.SetFocus
Exit Sub
End If
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] ... 下一页 >>