I found this code that will auto update the front end of a database. I am having issues getting to actually work for me.

I use a table called AppConstants on the server's backend that has two columns: ConstantTitle and ConstantValue. One of the rows has ConstantTitle set to "AppVersion" and ConstantValue set to the version number.

Then I have a field with visibility set to False on my main form called VersionNo, and I set this field's value to ="VersionNumber" (where VersionNumber is the actual version number, e.g. ="1.25"). On the Main Form's OnLoad event, I have a macro that runs a DLookup in an IF command:

```
if DLookUp("[ConstantValue]", "tblAdmin", "[ConstantTitle] ='AppVersion'")    <>[Forms]![frmMain]![VersionNo] Then RunCode OpenUpdater()
Quit Access
End If

```

The code for OpenUpdater: 

```
Code:
Function OpenUpdater()  'This sets the name of the code to call later
Dim accapp As Access.Application
Set accapp = New Access.Application
accapp.OpenCurrentDatabase ("C:\$Data\MyUpdater.accde")  'Starts up   this   file
accapp.Visible = True
End Function

```

What it's doing: The macro checks the value of the VersionNumber in the table on the server. When I update the app copy on the server, I set a new version number in here and set my app copy's VersionNo field to the same number. When you're running the old version, your app sees that the version numbers don't match, and then it executes the Macro's 'Then' commands: it runs the OpenUpdater code and shuts itself off.

The OpenUpdater code simply starts the MyUpdater.accde program, which is by default installed on the user's PC along with the application itself. The OpenUpdater program executes the following code:

```
Code:
DoCmd.ShowToolbar "Ribbon", acToolbarNo

'Copy the new version to the C drive
Dim SourceFile, DestinationFile As String
SourceFile = "Z:\Server\MyProgram.accde"   'Where to get the fresh copy
DestinationFile = "C:\$Data\MyProgram.accde"   'Where to put it
With CreateObject("Scripting.FileSystemObject")
.copyfile SourceFile, DestinationFile, True     'This line does the  acual  copy and paste
End With

'Reopen MyProgram
Dim accapp As Access.Application
Set accapp = New Access.Application
accapp.OpenCurrentDatabase ("C:\$Data\MyProgram.accde")
accapp.Visible = True
End Function

```

This Function is called in a Macro within MyUpdater, and the command just after the RunCode in this Macro is QuitAccess, which shuts off the Updater.

So my main program, when you open the main form, checks the version number on the server. If they're different, the main program starts the updater and then shuts itself down. The updater copies the fresh version off the server and pastes it in the correct place on the C drive, then starts up the program and shuts itself down.

From the end-user's perspective, the program starts, immediately quits, and then starts again a second or so later and now it's updated. It works awesome. 

I followed all of the directions, when I run it a .laccdb pops up. Can anyone provide clarity on why this is happening?

Here is what I put in (In two separate modules)
 Option Compare Database

```
DoCmd.ShowToolbar "Ribbon", acToolbarNo

'Copy the new version to the C drive
Dim SourceFile, DestinationFile As String
SourceFile = "C:\Users\Tyrone\Desktop\MasterDatabase.accdb"   'Where to get  the fresh copy
DestinationFile = "C:\Users\Tyrone\Desktop\copy.accdb"   'Where to put it
With CreateObject("Scripting.FileSystemObject")
.CopyFile SourceFile, DestinationFile, True    'This line does the acual    copy and paste
End With

'Reopen MyProgram
Dim accapp As Access.Application
Set accapp = New Access.Application
accapp.OpenCurrentDatabase ("C:\Users\Tyrone\Desktop\copy.accdb")
accapp.Visible = True
End Function

Function OpenUpdater()  'This sets the name of the code to call later
Dim accapp As Access.Application
Set accapp = New Access.Application
accapp.OpenCurrentDatabase  ("C:\Users\Tyrone\Desktop\MyUpdater.accde")  'Starts up this file
accapp.Visible = True
End Function

```