Public n As Integer
Dim txtSQL As String
Private Sub Form_Load()
n = 0'n保存登录的次数
End Sub
Private Sub cmdOK_Click()
Dim mrc As ADODB.Recordset
txtSQL = "select * from oper where 用户名='" & Trim$(txtName.Text) & "' And 密码 = '" & Trim$(txtKey.Text) + "'"
Set mrc = exesql(txtSQL)
If mrc.RecordCount = 0 Then '未找到用户记录
在工具-引用里面,看你是否引用了microsoft activeX data object 2.8 library,没有的话在前面加上x然后再运行,如果不行就把microsoft ADO Ext 2.8 for DDL and Security也加上x,应该就可以了,是你的EXCEL没有引用microsoft的工程...