Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / June 2007

Tip: Looking for answers? Try searching our database.

open dao dbsnapot in password protected database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
77m.grub@gmail.com - 14 Jun 2007 14:13 GMT
Below is the code, but basically the code snippet compares a server
and local version of the database....  Note that the user has neither
the server or local versions of the database open when this code is
executed; it is executed from a third, separate database file that
executes this code automatically when the user clicks to open the it
(the third database).  \

Problem is that both the server and local database files are database
password protected (database password NOT user-level password
security).  I cannot figure out how to open the databases if they have
a database password.  Any ideas?  Thanks!  Mike

Dim rst As DAO.Recordset
Dim ServerDir As String
Dim LocalDir As String
Dim ServerFile As String
Dim LocalFile As String
Dim ServerVersion As Integer

ServerDir = "\\myserver\serverdb"
LocalDir = "C:\Program Files\localdb"

ServerFile = ServerDir & "\serverdb.mdb"
LocalFile = LocalDir & "\localdb.mdb"

On Error GoTo Err_Handler

   Set rst = CurrentDb.OpenRecordset("SELECT Version FROM tblAdmin IN
'" & ServerFile & "'", dbOpenSnapshot)
   ServerVersion = rst!Version
   rst.Close

   Set rst = CurrentDb.OpenRecordset("SELECT Version FROM tblAdmin IN
'" & LocalFile & "'", dbOpenSnapshot)
   LocalVersion = rst!Version
   rst.Close

   If ServerVersion > LocalVersion Then
       MsgBox "An update to the database is available.  Press OK to
apply update."
       Kill LocalFile
       FileCopy ServerFile, LocalFile
       MsgBox "Update complete.  Click OK to continue."
   End If

   Set rst = Nothing
   Me.TimerInterval = 10
   Exit Sub

Err_Handler:
   MsgBox "                Microsoft Access encountered an error." &
vbCrLf & "You may not have the most recent version of the database." &
vbCrLf & "             Please contact your system administrator."
   Form_Timer
   Exit Sub

End Sub
Dirk Goldgar - 14 Jun 2007 17:25 GMT
> Below is the code, but basically the code snippet compares a server
> and local version of the database....  Note that the user has neither
[quoted text clipped - 7 lines]
> security).  I cannot figure out how to open the databases if they have
> a database password.  Any ideas?  Thanks!  Mike
[...]

> ServerDir = "\\myserver\serverdb"
> LocalDir = "C:\Program Files\localdb"
[quoted text clipped - 13 lines]
>    LocalVersion = rst!Version
>    rst.Close

Try something like this:

   ' ...
   Dim ServerPW As String
   Dim LocalPW As String

   ServerPW = "YourPW"
   LocalPW = "YourOtherPW"

   Set rst = CurrentDb.OpenRecordset( _
       "SELECT Version FROM [MS Access;Database=" & _
           ServerFile & ";pwd=" & ServerPW & "].tblAdmin",
       dbOpenSnapshot)
   ServerVersion = rst!Version
   rst.Close

   Set rst = CurrentDb.OpenRecordset( _
       "SELECT Version FROM [MS Access;Database=" & _
           LocalFile & ";pwd=" & LocalPW & "].tblAdmin",
       dbOpenSnapshot)
   LocalVersion = rst!Version
   rst.Close

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

77m.grub@gmail.com - 14 Jun 2007 18:34 GMT
On Jun 14, 12:25 pm, "Dirk Goldgar" <d...@NOdataSPAMgnostics.com>
wrote:
> Innews:1181826819.068230.131700@d30g2000prg.googlegroups.com,
>
[quoted text clipped - 59 lines]
>
> - Show quoted text -

Worked!  Thanks!

Mike
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.