【正文】
olean Dim mrc As txtSQL = select * from 院系信息表 where If Then If Trim() = Then sMeg = 院系名稱不能為空 MsgBox sMeg, vbOKOnly + vbExclamation, 警告 Exit Sub Else dd(0) = True If dd(1) Then txtSQL = txtSQL amp。 and 院系名稱 = 39。 amp。 amp。 39。 Else txtSQL = txtSQL amp。 院系名稱 = 39。 amp。 amp。 39。 End If End If End If If Then If Trim() = Then sMeg = 院系編號不能為空 MsgBox sMeg, vbOKOnly + vbExclamation, 警告 Exit Sub Else If Not IsNumeric(Trim()) Then MsgBox 請輸入數(shù)字! , vbOKOnly + vbExclamation, 警告 Exit Sub 39 End If dd(1) = True txtSQL = txtSQL amp。 院系編號 = amp。 Trim() 39。amp。 39。 End If End If If Not (dd(0) Or dd(1) Or dd(2)) Then MsgBox 請設(shè)置查詢方式! , vbOKOnly + vbExclamation, 警告 Exit Sub End If txtSQL = txtSQL amp。 order by 院系名稱 Set mrc = ExecuteSQL(txtSQL, MsgText) With MSFlexGrid1 .Rows = 2 .CellAlignment = 1 .TextMatrix(1, 0) = 編號 .TextMatrix(1, 1) = 院系名稱 .TextMatrix(1, 2) = 院系負(fù)責(zé)人 .TextMatrix(1, 3) = 院系編號 .TextMatrix(1, 4) = 院系專業(yè) .TextMatrix(1, 5) = 院系電話 Do While Not .Rows = .Rows + 1 .CellAlignment = 4 .TextMatrix(.Rows 1, 0) = (0) .TextMatrix(.Rows 1, 1) = (1) .TextMatrix(.Rows 1, 2) = (2) .TextMatrix(.Rows 1, 3) = (3) .TextMatrix(.Rows 1, 4) = (4) .TextMatrix(.Rows 1, 5) = (5) Loop End With End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() With MSFlexGrid1 .CellAlignment = 4 .TextMatrix(1, 0) = 編號 40 .TextMatrix(1, 1) = 院系名稱 .TextMatrix(1, 2) = 院系負(fù)責(zé)人 .TextMatrix(1, 3) = 院系編號 .TextMatrix(1, 4) = 院系專業(yè) .TextMatrix(1, 5) = 院系電話 End With End Sub 設(shè)置年級課程信息代碼如下: Private Sub Combo1_Change() Dim mrc As Dim txtSQL As String Dim MsgText As String Dim i As Integer 39。清除列表框內(nèi)容 txtSQL = select * form 年 級 課 程 設(shè) 置 表 where 院 系 名 稱=39。 amp。 amp。 39。 Set mrc = ExecuteSQL(txtSQL, MsgText) End Sub Private Sub Combo2_Change() Dim mrc As Dim txtSQL As String Dim MsgText As String Dim i As Integer 39。清除列表框內(nèi)容 txtSQL = select * form 年 級 課 程 設(shè) 置 表 where 年級=39。 amp。 amp。 39。 Set mrc = ExecuteSQL(txtSQL, MsgText) End Sub Private Sub Command1_Click() If 1 Then () End If End Sub Private Sub Command2_Click() If 1 Then End If End Sub Private Sub Command3_Click() Dim mrc As Dim txtSQL As String Dim MsgText As String 39。使各個控件有效 = True = True 41 = True 39。查詢數(shù)據(jù) txtSQL = select * form 課程信息表 Set mrc = ExecuteSQL(txtSQL, MsgText) While ( = False) (1) Wend flagset = True End Sub Private Sub Command4_Click() Dim i As Integer Dim mrc As Dim mrcc As Dim txtSQL As String Dim MsgText As String Dim myBookmark As Variant If Not Testtxt() Then MsgBox 請先選擇院系名稱! , vbOKOnly + vbExclamation, 警告 Exit Sub End If If Not Testtxt() Then MsgBox 請先選擇年級 ! , vbOKOnly + vbExclamation, 警告 Exit Sub End If If Not Testtxt((0)) Then MsgBox 請先選擇課程 ! , vbOKOnly + vbExclamation, 警告 Exit Sub End If For i = 1 To txtSQL = select * from 年 級 課 程 設(shè) 置 表 where 年級=39。 amp。 Trim() amp。 39。and 39。 amp。 Trim() amp。 39。Set mrc = ExecuteSQL(txtSQL, MsgText) If = True And = True Then (院系名稱 ) = Trim() (年級 ) = Trim() (課程名稱 ) = Trim((i 1)) End If 42 Next i = = End Sub Private Sub Command5_Click() Unload Me End Sub Private Sub Form_Load() Dim mrc As Dim txtSQL As String Dim MsgText As String txtSQL = select * from 班級信息表 Set mrc = ExecuteSQL(txtSQL, MsgText) While = False (年級 ) Wend txtSQL = select * from 院系信息表 Set mrc = ExecuteSQL(txtSQL, MsgText) While = False (院系名稱 ) Wend txtSQL = select * from 課程信息表 Set mrc = ExecuteSQL(txtSQL, MsgText) While = False (課程名稱 ) Wend End Sub Private Sub List1_Click() If 1 Then = 1 End If End Sub Private Sub List2_Click() If 1 Then = 1 End If End Sub