469,356 Members | 2,117 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

Error 3051 when opening workgroup-secured file

I'm getting Error 3051 with the following snippet of code. What I'm trying
to do is to open an update version on the server (ServerFile) to check it's
version number in a front-end table(VersionRef) and compare it with the
version number of the LocalFile which has the same front-end table.
WorkgroupFileName is determined elsewhere. WorkgroupFileName, ServerFile
and LocalFile are all correct (I've stepped through the code to verify that
they are correct). The 3051, permissions error, occurs on the line indicated,
when trying to open the ServerFile.

Is using this method the correct way to open workgroup secured files. This
used to work fine, until I started using Access 2003. It still works fine
with A2K, but not A2003.

Set dbe = New PrivDBEngine

With dbe
' start Jet.
.SystemDB = WorkgroupFileName
.DefaultUser = "defaultadmin"
.DefaultPassword = "adminpwd"

' open workspace, database, recordset for Local File.
Set ws = .Workspaces(0)
Set db = ws.OpenDatabase(LocalFile)
Set rs = db.OpenRecordset("SELECT * FROM VersionRef", dbOpenSnapshot)
LocalDBType = rs("DB_TYPE")
LocalVersion = rs("Version")
rs.Close
db.Close

' open workspace, database, recordset for Server File.
Set ws = .Workspaces(0)
Set db = ws.OpenDatabase(ServerFile)
'ERROR 3051 occurs on the following line.
Set rs = db.OpenRecordset("SELECT * FROM VersionRef", dbOpenSnapshot)
FreshDBType = rs("DB_TYPE")
FreshVersion = rs("Version")
rs.Close
db.Close

End With

--
Message posted via http://www.accessmonster.com
Apr 10 '06 #1
2 5511
Correction:

The error actually occurred on the following line:

Set db = ws.OpenDatabase(ServerFile)

rdemyan wrote:
I'm getting Error 3051 with the following snippet of code. What I'm trying
to do is to open an update version on the server (ServerFile) to check it's
version number in a front-end table(VersionRef) and compare it with the
version number of the LocalFile which has the same front-end table.
WorkgroupFileName is determined elsewhere. WorkgroupFileName, ServerFile
and LocalFile are all correct (I've stepped through the code to verify that
they are correct). The 3051, permissions error, occurs on the line indicated,
when trying to open the ServerFile.

Is using this method the correct way to open workgroup secured files. This
used to work fine, until I started using Access 2003. It still works fine
with A2K, but not A2003.

Set dbe = New PrivDBEngine

With dbe
' start Jet.
.SystemDB = WorkgroupFileName
.DefaultUser = "defaultadmin"
.DefaultPassword = "adminpwd"

' open workspace, database, recordset for Local File.
Set ws = .Workspaces(0)
Set db = ws.OpenDatabase(LocalFile)
Set rs = db.OpenRecordset("SELECT * FROM VersionRef", dbOpenSnapshot)
LocalDBType = rs("DB_TYPE")
LocalVersion = rs("Version")
rs.Close
db.Close

' open workspace, database, recordset for Server File.
Set ws = .Workspaces(0)
Set db = ws.OpenDatabase(ServerFile)
'ERROR 3051 occurs on the following line.
Set rs = db.OpenRecordset("SELECT * FROM VersionRef", dbOpenSnapshot)
FreshDBType = rs("DB_TYPE")
FreshVersion = rs("Version")
rs.Close
db.Close

End With


--
Message posted via http://www.accessmonster.com
Apr 10 '06 #2
"rdemyan via AccessMonster.com" <u6836@uwe> wrote in
news:5e91ce375a5da@uwe:
The error actually occurred on the following line:

Set db = ws.OpenDatabase(ServerFile)


I was Googling on a completely different set of errors this morning
and ran across a thread where somebody found that this:

Dim dbe As New DBEngine
Set db = dbe.OpenDatabase(...)

solved a similar kind of problem.

I'm not sure why you're using a separate workspace object for this,
anyway, since you're using the default workspace.

Indeed, it seems to me that you should be able to open your database
with DBEngine.OpenDatabase.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Apr 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mark | last post: by
3 posts views Thread by zav | last post: by
11 posts views Thread by Phil | last post: by
8 posts views Thread by rdemyan via AccessMonster.com | last post: by
reply views Thread by umshamma | last post: by
reply views Thread by EJO | last post: by
1 post views Thread by =?Utf-8?B?Q29lbg==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.