[AccessD] Replication as a tool for updating FE

Jennifer Gross jengross at gte.net
Tue Sep 7 13:14:55 CDT 2010


Thanks David.  Might be a good 'get my feet wet' project in .net to see if I
can get your code working.

Jennifer

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David McAfee
Sent: Tuesday, September 07, 2010 10:48 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Replication as a tool for updating FE

Jennifer, another thing you can do is launch a batch file or some
other type of file.

I wrote a little VB.Net "launcher" that I use. I compile it one time
and create a text file (renamed to *.ini)
that contains two lines:
LatestVersion:PS_010.adp
DeleteVersion:PS_00*.adp

When I "release" a new versionof the FE, I simply copy the ADP (or
MDB, ACCDB) to the network, rename the file and increment the first
line in the ini file by one.
I like to leave the previous version incase I make a mistake and want
to quickly resort back to the old version. If I decided to delete a
block of old FE's still on the users system,
I put an asterisk in the "Delete" line (the example above will delete
PS_001.adp to PS_009.adp, if they exist on the users PC)

The compiled exe is copied to the users' desktop and they double click
it to launch the file.

The app starts, checks if the latest version already exists on the
users' PC. If it does, it launches it, if not it copies it over and
launches it.

Very simple. (a batch file can do the same, but this was a neat fun
.net project for me to write)
David


Imports System.IO
Imports System.Environment

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        Dim OldVersion As String = "" 'Don't update this string here,
they are populated by the ini file
        Dim NewVersion As String = "" 'Don't update this string here,
they are populated by the ini file
        Dim iniFile As String = "PS.ini"
        Dim NetPath As String = "\\fs1\MOCapps$\PS\"
        Dim LocPath As String =
System.Environment.GetFolderPath(SpecialFolder.LocalApplicationData).ToStrin
g
+ "\Moc\PS\"

        Debug.Print(LocPath)
        UpDateCaption("Reading ini")
        Dim oRead As System.IO.StreamReader
        Dim LineIn As String
        oRead = File.OpenText((NetPath + iniFile))

        While (oRead.Peek <> -1)
            LineIn = oRead.ReadLine
            If (LineIn.Substring(0, 14) = "LatestVersion:") Then
                NewVersion = LineIn.Substring((LineIn.Length -
(LineIn.Length - 14)))
            ElseIf (LineIn.Substring(0, 14) = "DeleteVersion:") Then
                OldVersion = LineIn.Substring((LineIn.Length -
(LineIn.Length - 14)))
                ' Delete the previous version
                ' If File.Exists(LocPath + OldVersion) Then
                '     File.Delete(LocPath + OldVersion)
                ' End If
            Else
                LineIn = ""
            End If

        End While
        oRead.Close()
        If Directory.Exists(NetPath) Then ' If the network path
exists, continue with the local path checks
            If Directory.Exists(LocPath) Then ' if the local path
exists then check for the actual file
                If Not File.Exists((LocPath + NewVersion)) Then '
Check to see if the new file is already installed
                    UpDateCaption("Copying ")
                    File.Copy((NetPath + NewVersion), (LocPath +
NewVersion)) ' If NOT, copy the file :)
                End If
            Else ' Directory did not exist, so create it and copy new file
over
                Directory.CreateDirectory(LocPath)
                File.Copy((NetPath + NewVersion), (LocPath + NewVersion))
            End If ' If the new file exists on local computer, start
the new version on the local PC
            If File.Exists((LocPath + NewVersion)) Then
                UpDateCaption("Starting application")
                System.Diagnostics.Process.Start((LocPath + NewVersion))
            Else
                MessageBox.Show(("Cannot find " + (LocPath +
(NewVersion + "."))), "unable to start PS")
            End If
            ' Delete the previous version
            ' If File.Exists(LocPath + OldVersion) Then
            ' File.Delete(LocPath + OldVersion)
            ' End If
            For Each FileFound As String In
Directory.GetFiles(LocPath, OldVersion)
                File.Delete(FileFound)
            Next
        Else
            ' The network path was unavailable, so alert the user
            MessageBox.Show(("Network path: " + (NetPath + " is
unavailable")), "Unable to start Pull Sheet Database")
        End If
        UpDateCaption("")
        Application.Exit()
    End Sub
    Private Sub UpDateCaption(ByVal strCaption As String)
        lblStatus.Text = strCaption
        System.Windows.Forms.Application.DoEvents()
    End Sub
End Class



On Tue, Sep 7, 2010 at 8:44 AM, Jennifer Gross <jengross at gte.net> wrote:
> It has been suggested to me to use Replication to keep the FE version up
to
> date.  I have never used replication for data and didn't even consider it
> for the FE/code side of things.  Does anyone have any experience with
> Replication as the means of propagating changes to the FE?
>
>
>
> Jennifer Gross
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list