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