【正文】
39。根據(jù)不同的用戶類型,使相應的菜單項可見 Select Case mnUserType Case 0: 39。以學生身份登錄, 只能查詢自己的信息 = False 39?!?信息查詢”按鈕不可見 (4).Visible = False 39。設置主窗體中所有最小化 MDI子窗體圖標重排 End Sub Private Sub mnuCas_Click() (0) 39。設置主窗體中所 有非最小化 MDI子窗體水平平鋪 End Sub Private Sub mnuLog_Click() If MsgBox(若重新登錄,所有窗體都將關閉! amp。 是否重新登錄? , _ vbQuestion + vbYesNo + vbDefaultButton2, 重新登錄 ) = vbYes Then Unload Me End If End Sub Private Sub mnuStudent_Click() Load frmStudent End Sub Private Sub mnuVer_Click() (2) 39。表示當前用戶登錄所選擇的身份,即用戶類型 , 0表示教務管理人員; 1表示學生 Dim mnUserType As Integer Private Sub cmdCancel_Click() Unload Me End Sub Private Sub cmdOK_Click() 39。根據(jù)不同的身份,選擇不同的表用以查詢 Dim r As New Set r = Dim strSQL As String Select Case mnUserType Case 0: 39。 amp。 39。 amp。 39。若身份為學生 strSQL = select * from 學生信息表 where name=39。 user amp。 and serial=39。 pwd amp。 End Select On Error Resume Next 39。根據(jù) strSQL的內(nèi)容刷新 39。登錄失敗 MsgBox 對不起,無此用戶或者密碼不正確!請重新輸入!! , vbCritical, 錯誤 = 0 = Len(txtUser) nTryCount = nTryCount + 1 If nTryCount = 3 Then MsgBox 您無權操作本系統(tǒng)! , vbCritical, 錯誤 Unload Me End If Else 39。顯示 MDI窗體 , 并將用戶類型和用戶名傳到 MDI窗體中的 mnUserType, msUserName中 With frmMain .mnUserType = mnUserType .msUserName = user End With Load frmMain Unload Me End If End Sub Private Sub Form_Load() optUserType(0).Value = True End Sub Private Sub optUserType_Click(Index As Integer) mnUserType = Index End Sub Option Explicit Private Sub Command1_Click() Dim strCon1 As String Dim strCon2 As String On Error GoTo myerr If Trim() = Or Trim() = Then If MsgBox(請輸入查詢條件! , vbInformation, 提示 ) Then GoTo myerr End If Select Case Trim() Case 學號 strCon1 = Serial Case 姓名 strCon1 = Name Case 班級 strCon1 = Class Case 生日 strCon1 = Birthday Case 性別 strCon1 = Sex Case 家庭地址 strCon1 = Address Case 電話 strCon1 = Tel End Select Select Case Trim() Case 學號 strCon2 = Serial Case 姓名 strCon2 = Name Case 班級 strCon2 = Class Case 生日 strCon2 = Birthday Case 性別 strCon2 = Sex Case 家庭地址 strCon1 = Address Case 電話 strCon2 = Tel End Select select * from 學生信息表 where amp。 Trim() amp。 amp。 39。 amp。 amp。 _ Trim() amp。 amp。 39。添加 Combo1的子項作為查詢標準 (學號 ) (姓名 ) (班級 ) (生日 ) (性別 ) (家庭地址 ) (電話 ) = 0 39。添加 Combo3的子項作為邏輯連接符 (And) (Or) = 0 39。添加 Combo5的子項作為第二種關系符 (=) () (=) () (=) () = 0 End Sub Private Sub Form_Unload(Cancel As Integer) = True End Sub