Re: Unable to access folder from A2003
- From: "rdemyan via AccessMonster.com" <u6836@uwe>
- Date: Fri, 26 May 2006 01:48:28 GMT
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[quoted text clipped - 4 lines]
on my command lines.
app)
opens just fine.
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200605/1
.
- Follow-Ups:
- Re: Unable to access folder from A2003
- From: Wayne Morgan
- Re: Unable to access folder from A2003
- References:
- Unable to access folder from A2003
- From: rdemyan via AccessMonster.com
- Re: Unable to access folder from A2003
- From: Wayne Morgan
- Re: Unable to access folder from A2003
- From: rdemyan via AccessMonster.com
- Re: Unable to access folder from A2003
- From: Wayne Morgan
- Re: Unable to access folder from A2003
- From: rdemyan via AccessMonster.com
- Re: Unable to access folder from A2003
- From: Wayne Morgan
- Unable to access folder from A2003
- Prev by Date: Re: Access help
- Next by Date: Re: HELP!!! How to create automated Email in Access using a date field
- Previous by thread: Re: Unable to access folder from A2003
- Next by thread: Re: Unable to access folder from A2003
- Index(es):
Relevant Pages
|