运行后提示:“编译错误:未找到方法或数据成员”.是错在下面这个.mnUsertypeWith frmMain.mnUserType = mnUserType.msUsername = user
Option ExplicitPublic LoginSucceeded As BooleanDim mnUserType As IntegerPrivate Sub optUserType_Click(Index As Integer)mnUserType = IndexEnd SubPrivate Sub Form_Load()optUserType(0).Value = TrueEnd SubPrivate Sub cmdCancel_Click()Unload MeEnd SubPrivate Sub cmdOK_Click()'取得用户输入的用户名和密码Dim user As String, pwd As Stringuser = Trim(txtUser)pwd = Trim(txtPwd)'根据不同的身份,选择不同的表用以查询Dim r As New ADODB.RecordsetSet r = DataEnv.rssqlSeekDim strSQL As StringSelect Case mnUserTypeCase 0: '若身份为管理员strSQL = "select * from 系统人员表 where name=" & user & "and pwd=" & pwd & ""Case 1: '若身份为学生strSQL = "select * from 学生信息表 where name=" & user & " and serial=" & pwd & ""End SelectOn Error Resume Next'查询DataEnv.rssqlSeek的状态,如果已经打开,则先关闭If r.State = adStateOpen Then r.Closer.Open strSQL '根据strSQL的内容刷新DataEnv.rssqlSeek'用户密码错误的次数,如果错误次数超过3次,则退出系统Static nTryCount As IntegerIf r.EOF Then '登录失败MsgBox "对不起,无此用户或者密码不正确!请重新输入!!", vbCritical, "错误"txtUser.SetFocustxtUser.SelStart = 0txtUser.SelLength = Len(txtUser)nTryCount = nTryCount + 1If nTryCount >= 3 ThenMsgBox "您无权操作本系统!", vbCritical, "错误"Unload MeEnd IfElse '登录成功'显示MDI窗体,并将用户类型和用户名传到MDI窗体中的mnUserType, msUserName中With frmMain.mnUserType = mnUserType.msUsername = userEnd WithLoad frmMainfrmMain.ShowUnload MeEnd IfEnd Sub
引用第2楼happyangel于2006-11-08 11:49发表的:看了一下,你没定义msUsername