Results 1 to 9 of 9
  1. #1
    cbrxxrider is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Location
    Central NY
    Posts
    16

    Can't find local file.

    I'm trying to use the code shown in https://www.accessforums.net/code-re...end-33331.html. All I did was change the name of the database, server, and server location but for some reason when it opens Access 2013, the error comes up that Access can't find database file %userprofile%\appdata\local\redirect\ui1.3.2013.ac cdr, which obviously means it's not creating the local front end copy.

    I'm wondering if there might be something else I'm missing. I also tried removing the runtime since I'm not using that.



    "The .bat file should read:
    Code:
    @echo off
    REM file used to automatically update the Database when updates are available.
    if not exist %userprofile%\appdata\local\redirect\ui1.3.2013.accdr echo Database needs to update to newer version.
    if not exist %userprofile%\appdata\local\redirect\ui1.3.2013.accdr pause
    @echo off
    if not exist %userprofile%\appdata\local\redirect\ui1.3.2013.accdr if exist %userprofile%\appdata\local\redirect\ui*.accdr del %userprofile%\appdata\local\redirect\ui*.accdr
    
    
    if not exist %userprofile%\appdata\local\redirect\ui1.3.2013.accdr Robocopy \\DUI_NAS\data\database %userprofile%\appdata\local\redirect ui1.3.2013.accdr
    
    
    Start MSAccess.exe /runtime %userprofile%\appdata\local\redirect\ui1.3.2013.accdr
    
    
    Exit
    "

  2. #2
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    Are you seeing the file in your user profile subdirectory?

    Run the batch file from a command prompt instead of double clicking on it. You will be able to keep the window open that way and see if there were any problems.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Another issue could be IT security limitations.

    We have to install the frontend at C:\ root level because the code cannot copy into user folders. Manual copy/paste works, but the code errors.

    I use VBScript.

    Const OverwriteExisting = TRUE
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    'following will copy Access file
    objFSO.CopyFile "\\servername\path\filename.accdb", "c:\", OverwriteExisting
    'following will now open the Access file
    Set oShell = CreateObject("WScript.Shell")
    If objFSO.FolderExists("C:\Program Files\Microsoft Office\Office14") Then
    oShell.Run """C:\Program Files\Microsoft Office\Office14\msaccess.exe"" ""c:\MaterialsDatabase.accdb"""
    Else
    oShell.Run """C:\Program Files\Microsoft Office\Office12\msaccess.exe"" ""c:\MaterialsDatabase.accdb"""
    End If
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I do not believe I have ever seen a system folder named "appdata"

  5. #5
    cbrxxrider is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Location
    Central NY
    Posts
    16
    Quote Originally Posted by ItsMe View Post
    I do not believe I have ever seen a system folder named "appdata"
    Normally it's hidden.

  6. #6
    cbrxxrider is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Location
    Central NY
    Posts
    16
    Quote Originally Posted by Xipooo View Post
    Are you seeing the file in your user profile subdirectory?

    Run the batch file from a command prompt instead of double clicking on it. You will be able to keep the window open that way and see if there were any problems.
    I did try this as well with the same outcome, I'll try to script as well.

  7. #7
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    When you opened the batch file from a command prompt did you get any error messages? What were they?

  8. #8
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I used to write a lot of batch files. Now, not so much.
    When I tested the batch file from Post #1, it choked on the spaces in %userprofile% (C:\Documents and Settings\steve). DOS batch files expect the 8.3 file name format and does not handle spaces well.

    So here is an attempt to re-write the batch file. It might be easier to follow June's advice about using a VBScript file.....

    I added variables to make it easier to change the dB name.
    The two lines to change are:
    the dB name
    set dB="%userprofile%\appdata\local\redirect\ui1.3.2013.accdr"

    The path to the master FE file
    Set DBM = \\DUI_NAS\data\database


    USE AT YOUR OWN RISK!!! I AM NOT RESPONSIBLE FOR WHATEVER HAPPENS!!!

  9. #9
    cbrxxrider is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Location
    Central NY
    Posts
    16
    This works, thanks ssanfu!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 04-30-2013, 05:44 PM
  2. Replies: 2
    Last Post: 05-25-2012, 07:36 AM
  3. could not find file due split pasted file
    By alex_raju in forum Access
    Replies: 1
    Last Post: 07-18-2011, 11:27 AM
  4. Find file
    By forestgump in forum Programming
    Replies: 1
    Last Post: 05-15-2011, 10:44 AM
  5. Command Button to Find .doc file
    By cg1465 in forum Forms
    Replies: 8
    Last Post: 09-15-2010, 08:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums