Ok so the split has worked fine.
Its the deployment that is the tricky bit.
I now have the following code which I am testing.
Code:
Public Class Form1 Private Sub btnLaunchBusinessPlanningDb_Click(sender As Object, e As EventArgs) Handles btnLaunchBusinessPlanningDb.Click
On Error GoTo ErrTrap
AppActivate("BP Planning by PT_dept")
Me.Hide()
MsgBox("The Your DB System is already open.", vbSystemModal) ' vbSystemModal
Me.Dispose() 'Unload Form1
'Set Form1 = Nothing
End
CopyAndLoad:
If Dir("c:\BP Planning by PT_dept", vbDirectory) = "" Then MkDir("c:\BP Planning by PT_dept")
FileCopy("\\myNetWork\BP-MasterDashboard Source\BP Planning by PT_dept.accdb", "c:\BP Planning by PT_dept\BP Planning by PT_dept.accdb")
If Dir("C:\Program Files (x86)\Microsoft Office\OFFICE12\MSACCESS.EXE", vbDirectory) <> "" Then
Shell("C:\Program Files (x86)\Microsoft Office\OFFICE12\MSACCESS.EXE c:\BP Planning by PT_dept\BP Planning by PT_dept.accdb", vbNormalFocus)
Else
If Dir("C:\Program Files\Microsoft Office\OFFICE12\MSACCESS.EXE", vbDirectory) <> "" Then
Shell("C:\Program Files\Microsoft Office\OFFICE12\MSACCESS.EXE c:\BP Planning by PT_dept\BP Planning by PT_dept.accdb", vbNormalFocus)
Else
If Dir("C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE", vbDirectory) <> "" Then
Shell("C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE c:\BP Planning by PT_dept\BP Planning by PT_dept.accdb", vbNormalFocus)
Else
If Dir("C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE", vbDirectory) <> "" Then
Shell("C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE c:\BP Planning by PT_dept\BP Planning by PT_dept.accdb", vbNormalFocus)
Else
MsgBox("Could Not Find Microsoft Access Progrm. Please contact Your Support Info.", vbSystemModal)
End If
End If
End If
End If
Me.Dispose()
'Set Form1 = Nothing
End
Exit Sub
Resume
ErrTrap:
Select Case Err.Number
Case 5
GoTo CopyAndLoad
Case 70
MsgBox("Could Not Copy Current Version", vbSystemModal)
Me.Dispose() 'Unload Form1
'Set Form1 = Nothing
End
End Select
End Sub
End Class
The 'Set Form1 = Nothing does not compile.
I have also had to use me.Dispose rather than Form1.Unload etc...
I am just testing now. and will post again if there are any issues.
Thank you.