speakers_86
Registered User.
- Local time
- Today, 02:26
- Joined
- May 17, 2007
- Messages
- 1,919
Code:
Public Function InstallFE()
On Error GoTo ProcError
Dim strSourceFile As String
Dim strDestFile As String
Dim strAccessExePath As String
Dim lngResult As Long
Dim WSHShell As Object
Set WSHShell = CreateObject("WScript.Shell")
Dim MyShortcut As Object
Dim DesktopPath As String
' Read desktop path using WshSpecialFolders object
DesktopPath = WSHShell.SpecialFolders("Desktop")
'Create the source's path and file name.
strSourceFile = CurrentProject.FullName 'strFEMasterPath '"\\server\share\YourFEDatabase.mde"
strDestFile = DesktopPath & "\" & CurrentProject.Name 'CurrentProject.FullName
'Determine path of current Access executable.
strAccessExePath = SysCmd(acSysCmdAccessDir) & "MSAccess.exe "
If Dir(strSourceFile) = "" Then 'Something is wrong and
' the file is not there.
MsgBox "The file:" & vbCrLf & Chr(34) & strSourceFile & _
Chr(34) & vbCrLf & vbCrLf & _
"is not a valid file name. Please see your Administrator.", vbCritical, "Error Updating To New Version..."
GoTo ExitProc
Else 'copy the new version of app over the existing one.
lngResult = apiCopyFile(strSourceFile, strDestFile, False)
End If
'Modify strDestFile slightly so that it can be used
' with the Shell function.
strDestFile = """" & strDestFile & """"
MsgBox "Application Updated. Please wait while the application" & _
" restarts.", vbInformation, "Update Successful"
'Load new version, then close old one.
Shell strAccessExePath & strDestFile & "", vbMaximizedFocus
DoCmd.Quit
ExitProc:
Exit Function
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, , _
"Error in UpdateFEVersion event procedure..."
Resume ExitProc
End Function
How can I make the file that this code creates hidden? I thought there was a character I could just put in front of the file name to signify it should be hidden, and I could have sworn it was the $, but that did nothing.