none
Wyse Thin Client - Access Runtime Script RRS feed

  • General discussion

  • We currently run an Access Program that is Accessed from about 10 thin clients, and we decided to split the database into front and back end because we were experiencing some corruption issues. So we created a script to copy the front end to the local drive under the users documents folder and everything was working fine but all of a sudden things are working anymore. I am just stepping into this situation and not sure if there is an issue with the script or if it's a permission issue.

    Upon launching of the script we receive an error message:

    Windows Script Host

    Line: 8

    Char: 1

    Permission Denied

    Code: 800A0046

    Here is a version of the script:

    Set WshNetwork = CreateObject("WScript.Network")
    Set WshNetwork = Nothing
    OldName = "K:\Quality Prog$\Access Front End\DMR.accdb" 
    NewName = "C:\Users\Plt1QualInShip\Documents\DataLogging\FrontEnd1\DMR.accdb"
    retval = 0
    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    retval = objFSO.CopyFile(oldname, newName, True) 
    Set objFSO = Nothing
    Dim objShell
    Set objShell = CreateObject("Wscript.Shell")
    objShell.RUN "MSAccess.exe /runtime" & """C:\Users\Plt1QualInShip\Documents\DataLogging\FrontEnd1\DMR.accdb"""
    Set objShell = Nothing

    When we don't copy to local drive it doesn't pull data from front end. Any help would be greatly appreciated.

    • Changed type Bill_Stewart Wednesday, September 13, 2017 8:45 PM
    • Moved by Bill_Stewart Wednesday, September 13, 2017 8:46 PM This is not "fix/debug/rewrite my script for me" forum
    Tuesday, July 18, 2017 4:50 PM

All replies

  • The error message is straightforward - "permission denied" means what it says.

    You need to look at the line of code that is generating that error and debug from there.

    We are not able to debug your code for you from afar in a forum.


    -- Bill Stewart [Bill_Stewart]

    Tuesday, July 18, 2017 5:07 PM
  • You cannot split a file that is open.

    What you are trying to do does not make any sense.  Splitting a file will not help if you have locking issues. If any code is trying to alter access properties or a database schema then the file will have locking/corruption issues.

    The solution to this can only be arrived at by finding a very experienced Access programmer and finding the source of your issue.

    As  for your VBS code here is a better formatted version.  Look at what you are doing. Consider the error. "Permission Denied" is not a scripting issue it is telling you the target file is either open of protected.

    Set WshNetwork = CreateObject("WScript.Network")
    Set WshNetwork = Nothing
    
    OldName = "K:\Quality Prog$\Access Front End\DMR.accdb" 
    NewName = "C:\Users\Plt1QualInShip\Documents\DataLogging\FrontEnd1\DMR.accdb"
    retval = 0
    
    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    retval = objFSO.CopyFile(oldname, newName, True) 
    Set objFSO = Nothing
    
    Dim objShell
    Set objShell = CreateObject("Wscript.Shell")
    objShell.RUN "MSAccess.exe /runtime" & """C:\Users\Plt1QualInShip\Documents\DataLogging\FrontEnd1\DMR.accdb"""
    Set objShell = Nothing 

    Most of the lines in the file are unnecessary. The first two lines do nothing.

    On Error Resume Next
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    objFSO.CopyFile oldname, newName, True
    If Err Then
       WScript.Echo Err.Description
       WScript.Quit
    End If
    
    Set objShell = CreateObject("Wscript.Shell")
    objShell.RUN "MSAccess.exe /runtime ""C:\Users\Plt1QualInShip\Documents\DataLogging\FrontEnd1\DMR.accdb"""
    If Err Then
       WScript.Echo Err.Description
       WScript.Quit
    End If
    

    This cannot fix permissions or open file errors.

    It will also always copy the file even if it already exists. 


    \_(ツ)_/

    Tuesday, July 18, 2017 5:15 PM
  • Thanks for the clean up version of code, I tried this on one of the thin clients. It gives me an error invalid argument now.
    Tuesday, July 18, 2017 5:46 PM
  • Without the complete error it is hard to know what tis happening.


    \_(ツ)_/

    Tuesday, July 18, 2017 5:48 PM
  • I lost two lines somehow:

    On Error Resume Next
    OldName = "K:\Quality Prog$\Access Front End\DMR.accdb" 
    NewName = "C:\Users\Plt1QualInShip\Documents\DataLogging\FrontEnd1\DMR.accdb"
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    objFSO.CopyFile oldname, newName, True
    If Err Then
       WScript.Echo Err.Description
       WScript.Quit
    End If
    
    Set objShell = CreateObject("Wscript.Shell")
    objShell.RUN "MSAccess.exe /runtime ""C:\Users\Plt1QualInShip\Documents\DataLogging\FrontEnd1\DMR.accdb"""
    If Err Then
       WScript.Echo Err.Description
       WScript.Quit
    End If
    


    \_(ツ)_/

    Tuesday, July 18, 2017 5:50 PM
  • Thanks again for the revised version, still receive an Access Denied prompt right away. I have checked all permissions on all folders referenced in the code everything checks out. Any idea why with your code it throws up that message access denied?
    Tuesday, July 18, 2017 8:08 PM
  • Sorry but "Access denied" is not a scripting issue.  You need to find out why the file is open or locked.

    \_(ツ)_/

    Tuesday, July 18, 2017 8:27 PM