Re: Unable to access folder from A2003



Does the problem occur whether or not other users are also opening the
database on their computers? According to the help file, the default open
method when you use OpenDatabase() is shared. If the problem occurs when
others are also opening the database, you may want to try specifying False
for the option in case the default isn't working correctly.

If no other users are opening the file and you can only open the file the
first time you try after placing it in a new share then it sounds as if the
server computer isn't releasing the lock on the file when you close it. Go
to the server computer, right click My Computer and choose Manage. Under
System Tools go to Shared Folders then Open Files. Does it still show the
file as in use even though you've closed it?

Which line of code gives the problem, is it the OpenDatabase call? I show a
DBEngine object but not a PrivDBEngine object. What is the PrivDBEngine
object?

--
Wayne Morgan
MS Access MVP


"rdemyan via AccessMonster.com" <u6836@uwe> wrote in message
news:60ce0b2bb12cc@xxxxxx
I created the launching/update program. You're spot on as to the the
method
for updating. Here's the code (I made a few changes to protect passwords,
etc):

'*********************************************************************************************************************
Public Sub CheckforUpdates(LocalFile As String, ServerFile As String,
FileToBeUpdated As String)

'This routine checks for version updates to the front end and other
modules:
The variable FileToBeUpdated contains 'the module name that will be
updated.
It is used in the messagebox.

'1) Version number updates - checks the version numbers

On Error GoTo Err_Ctrl

Dim dbe As PrivDBEngine
Dim ws As DAO.Workspace, db As DAO.Database, rs As DAO.Recordset

Dim ServerVersion As String, LocalVersion As String
Dim UpdateFileName As String
Dim LocalDBType As String
Dim ServerDBType As String
Dim WorkgroupFileName As String
Dim X As Boolean
Dim Response As Integer

'First check the workgroup file
X = GetWorkGroupFile(WorkgroupFileName)

If X = False Then
MsgBox "Can't find the workgroup file. Cannot check for updates to
MyApp.
", vbOKOnly + vbCritical
GoTo Exit_Sub
End If


'Now get the version numbers of both the local file and the
'server file (possible update file)

Set dbe = New PrivDBEngine

With dbe
' start Jet.
.SystemDB = WorkgroupFileName
.DefaultUser = "compact" 'This is an administrative User ID
.DefaultPassword = "mypassword"

' 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 = Nz(rs("DB_TYPE"), "")
LocalVersion = Nz(rs("Version"), "")
rs.Close
db.Close

' open workspace, database, recordset for Server File.
Set ws = .Workspaces(0)
Set db = ws.OpenDatabase(ServerFile)
Set rs = db.OpenRecordset("SELECT * FROM VersionRef", dbOpenSnapshot)
ServerDBType = Nz(rs("DB_TYPE"), "")
ServerVersion = Nz(rs("Version"), "")
rs.Close
db.Close

End With



'Now compare versions
'Make sure only Jet versions are compared to Jet versions and SQL Server
versions
'to SQL Server versions
If ServerDBType = LocalDBType Then
If ServerVersion > LocalVersion Then

Response = MsgBox("A new version/update of " & FileToBeUpdated & "
is
available." & vbCrLf & vbCrLf & _
"Click 'OK' to download the new version/update to your PC.",
vbOKCancel + vbExclamation)

If Response = vbCancel Then
GoTo Exit_Sub
End If

DoCmd.Hourglass True

Kill LocalFile
FileCopy ServerFile, LocalFile

'Pause for execution
DoEvents
Pause (5000)

DoCmd.Hourglass False

End If

End If


Exit_Sub:
DoCmd.Hourglass False
Set rs = Nothing
Set db = Nothing
Set ws = Nothing
Set dbe = Nothing

Exit Sub

Err_Ctrl:
DoCmd.Hourglass False
MsgBox "Error No. " & Err.Number & " -> " & Err.Description, vbCritical
Resume Exit_Sub

End Sub
'******************************************************************************************************

Thanks.



Wayne Morgan wrote:
Ok, this is probably a file copy problem then, not a database problem.
What
is the updater app doing to check the files to see if you have the most
current one? What does it then do to copy the file from the share to your
computer? I suspect that it opens each file to check a version number in
them then tries to copy the newer file over the older one on your
computer.
If it doesn't close each file properly after checking the version numbers,
the file may still be locked. While you may be able to copy the newer file
if it is open, it will depend on what state it was put in when opened, you
definitely will NOT be able to overwrite the older file on your computer
while the older file is still open.

The problem at this point may be the way the updater is opening and
closing
the files or it may be that the "server" computer isn't closing the files
properly when the updater is done with them. Make sure that you have all
of
the available updates from http://update.microsoft.com installed on both
computers. There have been some updates that will fix slow releases of
locked network files. You may also need to contact the person or company
that created the updater program.

Just to verify, when you open your database, you actually open the updater
program instead. It checks the file versions, it copies the newer one to
your computer if necessary, then it launches your database application. Is
this correct?

I was having trouble copying the update file. There are no /excl
switches
on my command lines.
[quoted text clipped - 4 lines]
app)
opens just fine.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200605/1


.



Relevant Pages

  • Re: The right database for the job?
    ... Note that "many updates ... > the programmer that have to fix somebody elses code and/or database ... > devices under its control, it connects to a central "DB server" program ...
    (comp.databases)
  • Re: The right database for the job?
    ... Note that "many updates ... > the programmer that have to fix somebody elses code and/or database ... Whenever a PC gets a hardware interrupt from one of the hw ... it connects to a central "DB server" program ...
    (comp.databases)
  • Re: The right database for the job?
    ... Note that "many updates ... the programmer that have to fix somebody elses code and/or database ... Whenever a PC gets a hardware interrupt from one of the hw ... it connects to a central "DB server" program ...
    (comp.databases)
  • Re: Updating DB Locally
    ... and overwriting just wipes out all the ... >> changes made in the production database from the web and replaces ... >> etc.) but in practice it may be a disaster (lost updates). ... > server which is not mine. ...
    (comp.lang.php)
  • Re: How to prevent 404 error when a page is updated via ftp?
    ... the data is 1-minute averages and hourly average values for about 10 ... updates once a minute. ... file and uses ftp to send it to the web server, ... database is then used by the Visual Interdev website to display the data. ...
    (microsoft.public.frontpage.client)