标题:急需,为什么老有未设置变量的错误啊
取消只看楼主
wakfd209
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2005-6-25
 问题点数:0 回复次数:0 
急需,为什么老有未设置变量的错误啊

Option Explicit Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long Public OK As Boolean Dim txtSQL As String Dim mrc As ADODB.Recordset Dim MsgText As String Dim miCount As Integer

Private Sub Form_Load() Dim i As Integer i = 0 txtSQL = "select * from user_Form" Set mrc = ExecuteSQL(txtSQL, MsgText) With txtUserName Do While Not mrc.EOF i = i + 1 .AddItem Trim(mrc!user_ID) mrc.MoveNext Loop .ListIndex = i - 1 End With mrc.Close OK = False miCount = 0 End Sub

Private Sub cmdCancel_Click() OK = False Me.Hide End Sub

Private Sub cmdOK_Click() txtSQL = "select * from user_Form where user_ID = '" & txtUserName.Text & "'" Set mrc = ExecuteSQL(txtSQL, MsgText) If mrc.EOF = True Then MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告" txtUserName.SetFocus Else If Trim(mrc.Fields(1)) = Trim(txtPassword.Text) Then OK = True mrc.Close Me.Hide UserName = Trim(txtUserName.Text) Else MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告" txtPassword.SetFocus txtPassword.Text = "" End If End If miCount = miCount + 1 If miCount = 3 Then Me.Hide End If Exit Sub End Sub

Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer) EnterToTab KeyCode End Sub

Private Sub txtPassword_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Call cmdOK_Click End If End Sub

Private Sub txtUserName_Click() txtPassword.Text = "" End Sub

Private Sub txtUserName_KeyDown(KeyCode As Integer, Shift As Integer) EnterToTab KeyCode End Sub 再以上这段代码中,老有未设置变量的错误,请高手指教,具体该怎么改啊

搜索更多相关主题的帖子: 变量 Dim mrc String 
2005-06-25 19:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-21597-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.389348 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved