| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 492 人关注过本帖
标题:[求助]对象变量或with块变量未设置的问题
只看楼主 加入收藏
tangxiu
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-5-14
收藏
 问题点数:0 回复次数:0 
[求助]对象变量或with块变量未设置的问题
Option Explicit
Private miCount As Integer
'******************************************
Private Sub Form_Load()
Call cboDataUser
End Sub
'*****************************************
Private Sub cmdCancel_Click()
'取消,则gLoginSucceeded为False
gLoginSucceeded = False
End
End Sub
'********************************
Private Sub cmdOK_Click()
Dim txtsql As String
Dim rstLogin As ADODB.Recordset
Dim flag As String
gUserName = ""
gUserKind = ""
If Trim(cboLogin.Text = "") Then
MsgBox "用户名不能为空!", vbOKOnly + vbExclamation, "警告"
cboLogin.SetFocus
Else
txtsql = "select * from tbUser where UserId = '" & cboLogin.Text & "'"
flag = ExecuteSQL(txtsql, rstLogin, False)
If Trim(rstLogin.Fields(1)) = Trim(txtPassword.Text) Then
gUserName = Trim(cboLogin.Text)
gUserKind = Trim(rstLogin.Fields(2))
gLoginSucceeded = True
rstLogin.Close
Me.Hide
frmMain.Show
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
' ******************************************************************************
'过程名:cboDataUser
'说 明:为用户名列表赋值
'参 数:无
'返回值:无
' ******************************************************************************v
Public Sub cboDataUser()
Dim res As String
Dim txtsql As String
Dim rstcbo As ADODB.Recordset
Dim i As Integer
txtsql = "select UserId from tbUser"
res = ExecuteSQL(txtsql, rstcbo, False)
If rstcbo.RecordCount <> 0 Then'这地方出现91错误
For i = 0 To rstcbo.RecordCount - 1
cboLogin.AddItem (rstcbo.Fields(0))
rstcbo.MoveNext
Next
End If
End Sub
搜索更多相关主题的帖子: 变量 对象 
2007-05-14 17:08
快速回复:[求助]对象变量或with块变量未设置的问题
数据加载中...
 
   



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

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