Private Sub Command1_Click()
Dim sql As String
Dim rs As New ADODB.Recordset
Set rs = New ADODB.Recordset

Dim pwdcount As Integer
pwdcount = 0
 If Trim(Text1.Text = "") Then
        MsgBox "没有输入用户名称,请重新输入!", vbOKOnly + vbExclamation, "警告"
       Text1.SetFocus
    Else                                                '查询用户
        sql = "select * from 用户 where 用户名='" & Text1.Text & "'"
         Set rs = TransactSQL(sql)
        If iflag = 1 Then
            If rs.EOF = True Then
                MsgBox "没有这个用户,请重新输入!", vbOKOnly + vbExclamation, "警告"
               Text1.SetFocus
            Else
                If Trim(rs.Fields(1)) = Trim(Text2.Text) Then
                    rs.Close
                    Me.Hide
                    main.Show
                    Unload Me
                Else
                    MsgBox "密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
                Text2.SetFocus
                  Text2.Text = ""
                End If
            End If
        Else
            Unload Me
        End If
    End If
    pwdcount = pwdcount + 1                             '判断输入次数
    If pwdcount = 3 Then
        Unload Me
        Exit Sub
    End IfEnd Sub
为什么每次都说我的用户类型未定义呢

解决方案 »

  1.   

    错误提示出现在哪行??
    iflag这个变量在哪定义了?
      

  2.   

    你没有引入ado  选择工程菜单->引用  找到 microsoft activex date object library 2.0 
      

  3.   

    谢谢楼上两位高手,ADO我引入了以后,刚刚的问题解决了,现在又出现了新的问题, Set rs = TransactsSQL(sql)中的TransactsSQL说没有定义。哎。我是做毕业设计的,用的是ACCESS数据库,以前没有学过,所以现在是一头雾水啊,不知道数据库的名称应该是什么,也不能登陆界面,只要这两个问题解决了 就好了。
    麻烦高手指点了,谢谢