Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old April 10th, 2006, 05:05 AM
rdemyan via AccessMonster.com
Guest
 
Posts: n/a
Default 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
  #2  
Old April 10th, 2006, 02:45 PM
rdemyan via AccessMonster.com
Guest
 
Posts: n/a
Default Re: Error 3051 when opening workgroup-secured file

Correction:

The error actually occurred on the following line:

Set db = ws.OpenDatabase(ServerFile)



rdemyan wrote:[color=blue]
>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[/color]

--
Message posted via http://www.accessmonster.com
  #3  
Old April 10th, 2006, 08:55 PM
David W. Fenton
Guest
 
Posts: n/a
Default Re: Error 3051 when opening workgroup-secured file

"rdemyan via AccessMonster.com" <u6836@uwe> wrote in
news:5e91ce375a5da@uwe:
[color=blue]
> The error actually occurred on the following line:
>
> Set db = ws.OpenDatabase(ServerFile)[/color]

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/
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles