DBEngine.CreateWorkspace错误3002无法启动会话 [英] DBEngine.CreateWorkspace Error 3002 Could Not Start Session

查看:85
本文介绍了DBEngine.CreateWorkspace错误3002无法启动会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何从创建工作区242次后得到的运行时错误3002

中恢复?或者更好的是,首先要避免

获取它?


我正在为不同用户创建一个空白密码的工作区

命令找出哪些用户没有密码。如果我这样做了几次就可以了,这只是
罚款,但如果我想定期用

循环,它会在找到一个用户242次之后爆炸没有密码

(即成功打开工作区)。在我的代码中,我确实每次尝试释放

创建的工作区,但我完全得到相同的错误

可以预测我是否关闭/设置为空是不是。

也许我没有正确释放它。我必须做某种清理工作,但我不知道是什么。我现在唯一可以做的就是

关闭Access应用程序并重启它。


我把代码放在下面。我的测试是一个紧凑的循环,但通常

我有一个计时器,这会每10秒触发一次,或者无论用什么

用户请求显示此表单的刷新率信息。

为了简化这篇文章,我只是在做一个循环,但是想要

表明它不是因为它需要时间在CreateWorkspace之间

电话。我正在使用Access 2000.


TIA提供任何帮助,Christine

---------- Code Start ------ ------------------

dim mlWkSpace为long,mlBlank为长'模块级变量


Sub TestPwds()

Dim i As Integer

For i = 1 to 1000

MonitorBlankPwds

Next

结束子


函数MonitorBlankPwds(可选fMsg作为布尔值)作为整数

''''循环通过tbuUsers中的所有用户并返回True如果有的话

用户缺少密码。

''''如果可选参数fMsg为True,则会显示一个消息框

用户,

'''计算丢失密码的数量。

错误GoTo Err

Dim wrkdefault作为DAO.Workspace

Dim wrkNew作为DAO.Workspace

Dim fHasPwd As Boolean

Dim rs As New ADODB.Recordset

Dim iCountBlankPwds As Integer

Dim vbMsgBox As VbMsgBoxStyle

Dim sMsg As String


''设置wrkdefault = DBEngine.Workspaces(0)''<<<<尝试过它与&

没有这条线 - 不明白为什么我需要 - 但后来我不知道

为什么我有问题......: )


rs.Open选择用户ID,用户,来自tbuUsers的密码,_

CurrentProject.Connection,adOpenForwardOnly,

adLockBatchOptimistic


而不是rs.EOF


fHasPwd = False


''尝试使用空白Pwd登录到新工作区

设置wrkNew = DBEngine.CreateWorkspace(" NewWks",rs(" User")"")

mlWkSpace = mlWkSpace + 1


''如果最后一个语句出错,那么错误处理程序

''会将标志设置为True,因为它必须有密码。

''否则,能够登录,所以Pwd一定是空白的。

如果不是fHasPwd那么

''Debug.Print'空白密码:" &安培; rs(用户)

fPwdsMissing = True

iCountBlankPwds = iCountBlankPwds + 1

否则

mlBlank = mlBlank + 1

如果不是(wrkNew什么都没有)那么

wrkNew.Close

设置wrkNew = Nothing

结束如果

结束如果

rs.MoveNext

Wend

MonitorBlankPwds = iCountBlankPwds

rs.Close

设置rs = Nothing


如果fMsg那么

sMsg = iCountBlankPwds& "用户没有密码。

如果iCountBlankPwds = 0那么

vbMsgBox = vbInformation

否则

vbMsgBox = vbExclamation

结束如果

MsgBx sMsg,vbMsgBox,密码监视器

结束如果

退出函数

错误:

选择案例错误

案例3029''gcErrBadAccntOrPwd

''无法登录用户帐户空白Pwd

fHasPwd =真

继续下一步

Case Else

Debug.Print" MonitorBlankPwds错误:" ; &安培; mlWkSpace& " " &

mlBlank& vbCrLf& Err.Number& " " &安培; Err.Description

停止''<<<<就在这里,所以我可以看看发生了什么

Err_Handler Err.Number

结束选择

结束功能''MonitorBlankPwds

''-----------代码结束---------------------------

Does anyone have any idea how to recover from a run-time error 3002
which I get after creating a workspace 242 times? Or better yet, avoid
getting it in the first place?

I am creating a workspace with a blank password for different Users in
order to find out which Users do not have passwords. This works just
fine if I do it a few times, but if I want to do it periodically with a
loop, it bombs out after 242 times of finding a user with no password
(ie sucessfully opening a workspace). In my code, I do try to free the
created workspace each time, yet I get the same error totally
predictably whether or not I do the close/set to nothing or not.
Perhaps I am not freeing it correctly. Thre must be some kind of
cleanup I can do, but I don''t know what. The only thing I can do now is
close the Access Application and restart it.

I am putting the code below. My test here is a tight loop, but normally
I have a timer and this gets triggered every 10 seconds or whatever the
user requests as refresh rate for the form displaying this information.
To simplify for this post, I am just doing a loop, but wanted to
indicate that it is not because it needs time between CreateWorkspace
calls. I am using Access 2000.

TIA for any help, Christine
---------- Code Start ------------------------
dim mlWkSpace as long, mlBlank as long ''module level variables

Sub TestPwds()
Dim i As Integer
For i = 1 To 1000
MonitorBlankPwds
Next
End Sub

Function MonitorBlankPwds(Optional fMsg As Boolean) As Integer
'''' Cycles through all the Users in tbuUsers and returns True if any
Users are missing a Password.
'''' If the optional argument fMsg is True, a message box is presented to
the User,
'''' giving a count of the number of missing passwords.
On Error GoTo Err
Dim wrkdefault As DAO.Workspace
Dim wrkNew As DAO.Workspace
Dim fHasPwd As Boolean
Dim rs As New ADODB.Recordset
Dim iCountBlankPwds As Integer
Dim vbMsgBox As VbMsgBoxStyle
Dim sMsg As String

''Set wrkdefault = DBEngine.Workspaces(0) ''<<<<tried it with &
without this line - dont see why I should need - but then I don''t know
why I have a problem either.... :)

rs.Open "Select UserID, User, Password from tbuUsers", _
CurrentProject.Connection, adOpenForwardOnly,
adLockBatchOptimistic

While Not rs.EOF

fHasPwd = False

'' Attempt to log on to new workspace with blank Pwd
Set wrkNew = DBEngine.CreateWorkspace("NewWks", rs("User"), "")
mlWkSpace = mlWkSpace + 1

'' If an error occurred on last statement, then error handler
'' will set flag to True because it must have a password.
'' Otherwise, able to log on, so Pwd must''ve been blank.
If Not fHasPwd Then
''Debug.Print "Blank Password:" & rs("User")
fPwdsMissing = True
iCountBlankPwds = iCountBlankPwds + 1
Else
mlBlank = mlBlank + 1
If Not (wrkNew Is Nothing) Then
wrkNew.Close
Set wrkNew = Nothing
End If
End If
rs.MoveNext
Wend
MonitorBlankPwds = iCountBlankPwds
rs.Close
Set rs = Nothing

If fMsg Then
sMsg = iCountBlankPwds & " Users have no Password."
If iCountBlankPwds = 0 Then
vbMsgBox = vbInformation
Else
vbMsgBox = vbExclamation
End If
MsgBx sMsg, vbMsgBox, "Password Monitor"
End If
Exit Function
Err:
Select Case Err
Case 3029 ''gcErrBadAccntOrPwd
''Could not log on user account with blank Pwd
fHasPwd = True
Resume Next
Case Else
Debug.Print "MonitorBlankPwds Error: " & mlWkSpace & " " &
mlBlank & vbCrLf & Err.Number & " " & Err.Description
Stop ''<<<< Just here so I can look at what''s going on
Err_Handler Err.Number
End Select
End Function ''MonitorBlankPwds
''----------- end of code ---------------------------

推荐答案

2005年10月25日15:26:12 -0700, ct ****** @ stny.rr.com 写道:


tbuUsers?这听起来很像你自己的桌子。为什么不在该表中检查

null?

select * from tbuUsers其中Password为null


也许你可以解释为什么你有一个没有密码的tbuUsers

字段,并且同时依赖Access安全性。


-Tom。
On 25 Oct 2005 15:26:12 -0700, ct******@stny.rr.com wrote:

tbuUsers? That sounds a lot like your own table. Why not check for
nulls in that table?
select * from tbuUsers where Password is null

Perhaps you can explain why you have a tbuUsers without a Password
field, and rely on Access security at the same time.

-Tom.
有没有人知道如何从创建工作区242次后得到的运行时错误3002
中恢复?或者更好的是,避免首先获取它?

我正在为不同的用户创建一个空白密码的工作区,以便找出哪些用户没有密码。如果我这样做了几次就可以了,但如果我想定期用一个
循环,它会在找到没有密码的用户242次之后轰炸
(即成功打开工作区)。在我的代码中,我确实尝试每次释放
创建的工作区,但我完全得到相同的错误
可预测的是我是否关闭/设置为空。
也许我没有正确释放它。我必须做某种清理工作,但我不知道是什么。我现在唯一能做的就是关闭Access应用程序并重新启动它。

我在下面输入代码。我的测试是一个紧凑的循环,但通常
我有一个计时器,这会每10秒触发一次,或者无论用户请求什么作为显示此信息的表单的刷新率。
为简化对于这篇文章,我只是在做一个循环,但是想表明它不是因为它需要在CreateWorkspace
调用之间的时间。我正在使用Access 2000.

TIA提供任何帮助,Christine
---------- Code Start -------------- ----------
dim mlWkSpace为long,mlBlank为长''模块级变量

Sub TestPwds()
Dim i As Integer
对于i = 1到1000
MonitorBlankPwds
下一页

函数MonitorBlankPwds(可选fMsg为布尔值)作为整数
''''循环通过tbuUsers中的所有用户并返回True如果有任何
用户缺少密码。
''''如果可选参数fMsg为True,则会向用户显示一个消息框,
''''计算丢失密码的数量。
错误GoTo Err
Dim wrkdefault作为DAO.Workspace
Dim wrkNew作为DAO.Workspace
Dim fHasPwd As Boolean
Dim rs As New ADODB.Recordset
Dim iCountBlankPwds As Integer
Dim vbMsgBox as VbMsgBoxStyle
Dim sMsg As String

''设置wrkdefault = DBEngine .Workspaces(0)''<<<<<<<<<
没有这条线 - 不明白为什么我需要 - 但后来我不知道
为什么我有一个问题要么.... :)

rs.Open选择用户ID,用户,来自tbuUsers的密码,_
CurrentProject.Connection,adOpenForwardOnly,
adLockBatchOptimistic

虽然不是rs.EOF

fHasPwd = False

''尝试使用空白Pwd登录新工作区
设置wrkNew = DBEngine .CreateWorkspace(" NewWks",rs(" User"),"")
mlWkSpace = mlWkSpace + 1

''如果上一个语句出错,则出错处理程序
''将标志设置为True,因为它必须有密码。
''否则,能够登录,所以Pwd必须是空白的。
如果不是fHasPwd那么
''Debug.Print'空白密码:" &安培; rs(用户)
fPwdsMissing = True
iCountBlankPwds = iCountBlankPwds + 1
否则
mlBlank = mlBlank + 1
如果不是(wrkNew什么都没有)那么< wrkNew.Close
设置wrkNew = Nothing
结束如果
结束如果
rs.MoveNext
Wend
MonitorBlankPwds = iCountBlankPwds
rs 。关闭
设置rs = Nothing

如果fMsg那么
sMsg = iCountBlankPwds& "用户没有密码。
如果iCountBlankPwds = 0那么
vbMsgBox = vbInformation
其他
vbMsgBox = vbExclamation
结束如果
MsgBx sMsg,vbMsgBox, 密码监视器
结束如果
退出功能
错误:
选择案例错误
案例3029''gcErrBadAccntOrPwd
''无法登录用户帐号用空白Pwd
fHasPwd = True
继续下一步
案例等
Debug.Print" MonitorBlankPwds错误:" &安培; mlWkSpace& " " &
mlBlank& vbCrLf& Err.Number& " " &安培; Err.Description
停止''<<<<就在这里,我可以看看发生了什么
Err_Handler Err.Number
结束选择
结束功能''MonitorBlankPwds
''-------- ---代码结束---------------------------
Does anyone have any idea how to recover from a run-time error 3002
which I get after creating a workspace 242 times? Or better yet, avoid
getting it in the first place?

I am creating a workspace with a blank password for different Users in
order to find out which Users do not have passwords. This works just
fine if I do it a few times, but if I want to do it periodically with a
loop, it bombs out after 242 times of finding a user with no password
(ie sucessfully opening a workspace). In my code, I do try to free the
created workspace each time, yet I get the same error totally
predictably whether or not I do the close/set to nothing or not.
Perhaps I am not freeing it correctly. Thre must be some kind of
cleanup I can do, but I don''t know what. The only thing I can do now is
close the Access Application and restart it.

I am putting the code below. My test here is a tight loop, but normally
I have a timer and this gets triggered every 10 seconds or whatever the
user requests as refresh rate for the form displaying this information.
To simplify for this post, I am just doing a loop, but wanted to
indicate that it is not because it needs time between CreateWorkspace
calls. I am using Access 2000.

TIA for any help, Christine
---------- Code Start ------------------------
dim mlWkSpace as long, mlBlank as long ''module level variables

Sub TestPwds()
Dim i As Integer
For i = 1 To 1000
MonitorBlankPwds
Next
End Sub

Function MonitorBlankPwds(Optional fMsg As Boolean) As Integer
'''' Cycles through all the Users in tbuUsers and returns True if any
Users are missing a Password.
'''' If the optional argument fMsg is True, a message box is presented to
the User,
'''' giving a count of the number of missing passwords.
On Error GoTo Err
Dim wrkdefault As DAO.Workspace
Dim wrkNew As DAO.Workspace
Dim fHasPwd As Boolean
Dim rs As New ADODB.Recordset
Dim iCountBlankPwds As Integer
Dim vbMsgBox As VbMsgBoxStyle
Dim sMsg As String

''Set wrkdefault = DBEngine.Workspaces(0) ''<<<<tried it with &
without this line - dont see why I should need - but then I don''t know
why I have a problem either.... :)

rs.Open "Select UserID, User, Password from tbuUsers", _
CurrentProject.Connection, adOpenForwardOnly,
adLockBatchOptimistic

While Not rs.EOF

fHasPwd = False

'' Attempt to log on to new workspace with blank Pwd
Set wrkNew = DBEngine.CreateWorkspace("NewWks", rs("User"), "")
mlWkSpace = mlWkSpace + 1

'' If an error occurred on last statement, then error handler
'' will set flag to True because it must have a password.
'' Otherwise, able to log on, so Pwd must''ve been blank.
If Not fHasPwd Then
''Debug.Print "Blank Password:" & rs("User")
fPwdsMissing = True
iCountBlankPwds = iCountBlankPwds + 1
Else
mlBlank = mlBlank + 1
If Not (wrkNew Is Nothing) Then
wrkNew.Close
Set wrkNew = Nothing
End If
End If
rs.MoveNext
Wend
MonitorBlankPwds = iCountBlankPwds
rs.Close
Set rs = Nothing

If fMsg Then
sMsg = iCountBlankPwds & " Users have no Password."
If iCountBlankPwds = 0 Then
vbMsgBox = vbInformation
Else
vbMsgBox = vbExclamation
End If
MsgBx sMsg, vbMsgBox, "Password Monitor"
End If
Exit Function
Err:
Select Case Err
Case 3029 ''gcErrBadAccntOrPwd
''Could not log on user account with blank Pwd
fHasPwd = True
Resume Next
Case Else
Debug.Print "MonitorBlankPwds Error: " & mlWkSpace & " " &
mlBlank & vbCrLf & Err.Number & " " & Err.Description
Stop ''<<<< Just here so I can look at what''s going on
Err_Handler Err.Number
End Select
End Function ''MonitorBlankPwds
''----------- end of code ---------------------------






Tom,

是的,tbuUsers是我自己的桌子。 MonitorBlankPwds

例程的意图是它将更新tbuUsers中的密码字段,尽管

我已经删除了在故障排除过程中执行此操作的行

3002运行时错误,只是为了确保这不是

问题的一部分。密码字段只是一个真/假字段,我通常会在此例程中设置
。我有一个表格给系统管理员

显示用户信息:谁登录的时间,是否他们使用这个表是否有b / b有密码等等。


我完全依赖Access安全性。 tbuUsers表只是发生了

,有一个字段用于指示用户是否有密码。

MonitorBlankPwds是更新它的字段。


您对DBEngine.Createworkspace问题有什么想法吗?我想要排除故障吗?


谢谢,

Christine

Tom,
Yes, tbuUsers is my own table. The intention of the MonitorBlankPwds
routine is that it will update the Password field in tbuUsers, although
I had removed the line that does that in the process of troubleshooting
the 3002 run-time error, just to be sure that that was not part of the
problem. The Password field is just a True/False field which I would
normally set in this routine. I have a form for system administrators
that displays User information: who is logged on when, whether they
have a password, etc which uses this table.

I rely completely on Access security. The tbuUsers table just happens
to have a field for indicating whether or not the User has a password.
MonitorBlankPwds is the field that updates it.

Do you have any ideas about the DBEngine.Createworkspace problem I am
trying to troubleshoot?

Thanks,
Christine


< ct ****** @ stny.rr.com>在消息中写道

news:11 ********************* @ g49g2000cwa.googlegro ups.com ...
<ct******@stny.rr.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
汤姆,
是的,tbuUsers是我自己的桌子。 MonitorBlankPwds例程的目的是它将更新tbuUsers中的Password字段,尽管我已经删除了在3002运行时错误的故障排除过程中执行该操作的行,只是为了确保这不是问题的一部分。密码字段只是一个真/假字段,我通常会在此例程中设置。我有一个系统管理员表单
显示用户信息:谁登录时,他们是否有密码等等使用此表。

我完全依赖访问安全性。 tbuUsers表只是发生了一个用于指示用户是否有密码的字段。
MonitorBlankPwds是更新它的字段。

你有什么想法吗?我正在尝试解决DBEngine.Createworkspace问题吗?

谢谢,
Christine
Tom,
Yes, tbuUsers is my own table. The intention of the MonitorBlankPwds
routine is that it will update the Password field in tbuUsers, although
I had removed the line that does that in the process of troubleshooting
the 3002 run-time error, just to be sure that that was not part of the
problem. The Password field is just a True/False field which I would
normally set in this routine. I have a form for system administrators
that displays User information: who is logged on when, whether they
have a password, etc which uses this table.

I rely completely on Access security. The tbuUsers table just happens
to have a field for indicating whether or not the User has a password.
MonitorBlankPwds is the field that updates it.

Do you have any ideas about the DBEngine.Createworkspace problem I am
trying to troubleshoot?

Thanks,
Christine




我可以''看到任何错误,但你可能已经将代码分解为更小的块,以使其更具可读性。在我的例子中,我已将代码分成两个函数 - 目的是创建一个将密码留空的顽皮

用户列表。既然你正在寻找用户级别的安全性,那么你可以直接进入用户组并通过每个用户循环
- 你可能有一个帐户不在你的桌子里。

你可以检查的其他几点是密码不是

非常明显,比如设置与登录名或设置相同到''密码''。

并且最后记住Access用户级安全性很容易破解 -

所以不要太信任它。 />

公共函数ListNaughtyUsers()为字符串


出错时GoTo Err_Handler


Dim grp作为DAO。 Group

Dim usr作为DAO.User

Dim strList As String


设置grp = DBEngine.Workspaces(0).Groups (用户)


for each usr in grp.Users

If HasBlankPassword(usr.Name)Then

strList = strList& "," &安培; usr.Name

结束如果

下一个usr


如果Len(strList)> 1然后

strList = Mid



I can''t see anything immediately wrong, but you could have broken the code
into smaller chunks to make it more readable. In my example, I have split
the code into two functions - with the aim of creating a list of naughty
users who have left their passwords blank. And since you are looking at
user-level security, you could just go straight to the ''Users'' group and
loop through each user - you may have an account which is not in your table.
A couple of other points you could check are that the passwords are not
blindingly obvious like set the same as the login name or set to ''password''.
and finally remember that Access user-level security is easily crackable -
so don''t put too much faith in it.

Public Function ListNaughtyUsers() As String

On Error GoTo Err_Handler

Dim grp As DAO.Group
Dim usr As DAO.User
Dim strList As String

Set grp = DBEngine.Workspaces(0).Groups("Users")

For Each usr In grp.Users
If HasBlankPassword(usr.Name) Then
strList = strList & "," & usr.Name
End If
Next usr

If Len(strList) > 1 Then
strList = Mid


这篇关于DBEngine.CreateWorkspace错误3002无法启动会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆