Shell File Not Found

speakers_86

Registered User.
Local time
Today, 07:54
Joined
May 17, 2007
Messages
1,919
So I have some code that is a variation of Bob Larson's fe update tool. It is tried and true on 5 different computers, but as soon as I put the db on the computer the db is actually intended for, the shell command does not work. I searched through 10 pages of google results, and tried many variation, but I always got file not found. Any ideas? The computer in question is Vista 64 bit, Access 2007.

edit- I am going to try the dev Ashish function fhandlfile when I go back to work. I have the weekend off, but I will report back later.
 
Last edited:
I don't understand your question?

Which exe file are you looking for if you are using the Shell Command?

If the exe file exists then it would be something like this:

Sub shell1()
Dim retval
retval = Shell("NotePad.exe", vbNormalFocus)

End Sub
 
I am trying to open C:\SER\UpdateFE.cmd. I created a blank text document in the same folder as my db, and tried Shell "test.txt", but it still said file not found.
 
What is the total code you are using. Both from the Text Document and Code in your Database.

Is the database in a Network Drive as that might be the issue.
 
On the computer with the issue, the database is stored on the local hard drive, on a older that is public so all user profiles can access it. Here is the code:

Code:
Public Sub ManageDatabase(strFrom As String, strTo As String, strRestart As String, strDelete As String)    'http://www.btabdevelopment.com/ts/freetools
    Dim ErrorName As String
    ErrorName = "InstallFrontEnd_Error"
    Dim ExitThisSub As String
    ExitThisSub = "Exit_" & ErrorName
    ProcedureError = "mdlBackupFE-BackupFrontEnd"
    Call TrackUsage("mdlBackupFE-BackupFrontEnd")
    If Nz(ErrHandling, -1) = -1 Then On Error GoTo ErrorName
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '    Dim strCmdBatch As String
    '    Dim notNotebook As Object
    '    Dim FSys   As Object
    Dim TestFile As String
    Dim strRestartFile As String
    ' sets the file name of the batch file to create
    TestFile = CurrentProject.Path & "\UpdateDbFE.cmd"
    ' sets the restart file name
    strRestartFile = """" & strRestart & """"
    ' creates the batch file
    Open TestFile For Output As #1
    Print #1, "Echo Off"
    Print #1, ""
    Print #1, "ping 1.1.1.1 -n 1 -w 2000"
    If strDelete = "" Then
    Else
        Print #1, "ECHO Deleting old file"
        Print #1, ""
        Print #1, "Del """ & strDelete & """"
    End If
    Print #1, ""
    Print #1, "Echo Copying new file"
    Print #1, "Copy /Y """ & strFrom & """ """ & strTo & """"
    Print #1, ""
    If strRestart = "" Then
    Else
        Print #1, "Echo CLICK ANY KEY TO RESTART THE ACCESS PROGRAM"
        Print #1, "START /I " & """MSAccess.exe"" " & strRestartFile
    End If
    Close #1
    'Exit Sub
    ' runs the batch file
    Shell TestFile
    'closes the current version and runs the batch file
    DoCmd.Quit
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
ExitThisSub:
    Exit Sub
ErrorName:
    Call LogError(Err.Number, Err.Description, ProcedureError, , True)
    Resume ExitThisSub
End Sub

It works beautifully on every machine but the one I need the db on.
 

Users who are viewing this thread

Back
Top Bottom