Problem with Update Code

rnutts

Registered User.
Local time
Today, 05:48
Joined
Jun 26, 2007
Messages
110
[FONT=Verdana, Arial, Helvetica]Hi

I have been looking for a way to update front ends automatically and came
upon the code below. I have changed it for my file names, however when the
front end needs to update I get an error message saying it cant find the
control Me.TimerInterval
I have tried replacing Me with Forms!Form1(the name of my form) but still it
falls over. This is the first time I have used TimerInterval so I am not
really sure what is going on. Could some one please let me know why this is
falling over other than the form form1 is closed when the timer interval is
specified.




Private Sub Form_Load()

Dim rst As DAO.Recordset
Dim BEPath As String
Dim ServerFile As String
Dim ServerVersion As Integer
Dim LocalFile As String
Dim LocalVersion As Integer



'find location of files (see note about assumptions below)

BEPath = Mid(CurrentDb.TableDefs("Analysts").Connect, 11)
ServerFile = "\\NWAPS-sbs\e\Assistdatabasefe\Database.mdb" '12 is specific
to this app’s backend MyApp_be.mdb
LocalFile = CurrentProject.Path & "\Database.mdb"



'identify the version numbers of the mde files

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



'replace local mde if later version is found on server

If ServerVersion > LocalVersion Then
DoCmd.OpenForm "form1"
Kill LocalFile
FileCopy ServerFile, LocalFile
DoCmd.Close acForm, "form1"
End If

Me.TimerInterval = 2000
Set rst = Nothing


End Sub

Second piece of code

Private Sub Form_Timer()

Dim LocalFile As String
Dim CmdToOpen As String



'close Pilot and launch main application

Me.TimerInterval = 0
LocalFile = CurrentProject.Path & "\Database.mdb"
CmdToOpen = """" & SysCmd(acSysCmdAccessDir) & "Msaccess.exe""" & " """ &
LocalFile & """"
Shell CmdToOpen, vbNormalFocus
DoCmd.Quit

End Sub
[/FONT]
 
Auto Update

Bob

Thanks for the program

I have a problem, in your instructions for using Auto-update automation point 3 you say the table labeled 'tbl-version_master_location' is not in the be it is in the fe master, please advise if this is correct

I have checked and I do believe that I selected the correct FE and BE files in the three available boxes you allowed on your form

Thanks

Richard
 
Just to be sure

Bob

Just to be sure I ran the program again after deleting the tables from FE and BE and the table definetly only appears in the FE

Thanks

Richard
 
I just ran the program on my sample frontend and backend. These are the tables that should be in the frontend:

FRONTEND
FEAU01.png



And in the backend:

BACKEND
FEAU02.png
 

Users who are viewing this thread

Back
Top Bottom