| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 653 人关注过本帖
标题:急需,为什么老有未设置变量的错误啊
只看楼主 加入收藏
wakfd209
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2005-6-25
收藏
 问题点数:0 回复次数:1 
急需,为什么老有未设置变量的错误啊

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
heihei2000
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2005-3-6
收藏
得分:0 
里面有变量是函数名!
2005-06-26 19:47
快速回复:急需,为什么老有未设置变量的错误啊
数据加载中...
 
   



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

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