Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 36
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770

    For automatic update of new version, review https://www.accessforums.net/code-re...end-33331.html
    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.

  2. #17
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    thank you, i'm trying to understand your code and run a test on my computer. you have
    Code:
    CreateObject("Scripting.FileSystemObject").CopyFile _
        gstrBasePath & "Program\Install\MaterialsDatabase.accdb", "c:\", True
    which i'm assuming is your path so i have
    Code:
    CreateObject("Scripting.FileSystemObject").CopyFile _
        gstrBasePath & "desktop\testnew\test1.accdb", "E:\", True
    which leads to a folder on my desktop that i put an updated version in, changed the text box caption to the new version, updated the version number in the BE version file to be the new number, seems all is understood but i'm getting a runtime error 76 path not found? can you tell me what i missed? its on my desktop, in a folder called testnew, file name is test1.accdb and my desktop is located on drive "E"
    Last edited by vicsaccess; 01-07-2016 at 07:30 PM. Reason: grammer, clarification

  3. #18
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Put either a msgbox or debug.print statement before CreateObject and review the path you are constructiing:
    Code:
    debug.print gstrBasePath & "desktop\testnew\test1.accdb"
    I'm thinking you have not defined the sub or function gstrBasePath?

  4. #19
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    gStrBasePath is a public constant I declared in a general module

    Use your pathing in its place.
    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.

  5. #20
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    thank you everyone, i'm trying to wrap my head around the code and the createobject part. i can't seem to find any documentation or articles on this use of it. i will only be using this path for this one method so i shouldn't need to declare the constant gstrbasepath, so i tried just entering the path of my update file (sorry it changed since i'm at work on work computer now), the path is C:users\myname\documents\testnew\test1.accdb but when entered as
    Code:
    CreateObject("Scripting.FileSystemObject").CopyFile _
         "Users\myname\Documents\testnew\test1.accdb", "C:\", True
    i am still getting a runtime error 76 path not found. do i have everything in the right place? why is the "C:\" seperated?

  6. #21
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    Here's a little info on CreateObject. The C:\ is separated because in the CreateObject method's signature we see CreateObject(class, server). The C:\ is the server which you are then creating the object in. You can change this as you see fit.

  7. #22
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The source path does not have drive letter designation. The "C:\" you see is the destination path.

    The CopyFile function has 3 arguments.
    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.

  8. #23
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Could someone enlighten me as to why not just use the FileCopy method? Is the CreateObject method better somehow?
    FileSystemObject.CopyFile "c:\Databases\myDatabases\Database_One.accdb", "c:\somePath\"
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #24
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Could be because for this to work, the copy action must be performed by Windows (the FileSystemObject).

    I don't remember if I tried Access FileCopy for this process.
    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.

  10. #25
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    thank you nick, i've been messing with this all afternoon and not quiet getting it. no matter how i configure the class or the server i still get the error 76 path not found. obviously i need to continue practicing more of the basics than this and i'll keep the FE's where they are for now and come back to this later.

  11. #26
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Put either a msgbox or debug.print statement before CreateObject and review the path you are constructing:
    So did you? I guess not, or else I'm wrong about the line below with **.

    The CopyFile function has 3 arguments.
    ...this isn't 3 arguments?
    "Users\myname\Documents\testnew\test1.accdb"
    , "C:\", True
    Sorry, I must be thick. The red part is not a path, so how does anyone expect this to work? AFAIK, the syntax for this is
    object.CopyFile ( source, destination, [overwrite] )

    **So the example is attempting to copy from "Users\myname\... " without specifying a drive?

    vicaccess, I have a working function using FileSystemObject.CopyFile if you care to see it. As long as you can specify both source and destination paths properly, it should work.

  12. #27
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    thank you micron, yes i did try debug and did get a good path to print. i'm sorry about my last post i'm just frustrated with this. its a great piece of code, June7 did a beautiful job of writing it, but i just can't wrap my mind around it. i usually don't ask someone to write something for me but rather to show me a working version of what ever it is so that i can learn from it. the worst thing i can do is put something in place and 6 months from now it breaks (as will happen) and i don't understand it enough to fix it. the only thing i can find close to this method was the article that Nick posted earlier. i'm trying to get it to work on this test DB on my desktop before i even think about using it on our network just so i can play with it and figure it out. i think with all of your help and suggestions that i have to change the setup that i have with the FE being on the shared drive, putting them on the desktops would be so much better and I've tested the performance of this and it improved dramatically, but i need a way to update them. if someone could just put my path in place and show me what i'm doing wrong or Micron if you have a better way that i can use that would be appreciated.

  13. #28
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    What drive is the master frontend on?

    Follow the example in post 23. With your path/file, like:
    CreateObject("Scripting.FileSystemObject").CopyFil e "X:\Users\myname\Documents\testnew\test1.accdb", "C:\", True

    This method REQUIRES the frontend to be on each user's computer (or at least in separate folders if on a network server). Each user must be running their own copy of the frontend, not a shared file.

    I install frontend to each user's computer C:\ root because of folder permission issues. I found that even though users could manually copy/paste files into various folders, code is blocked anywhere except to the root. Blame IT security settings.

    The master file must be in a folder with permissions that allow read access by anyone. A Users folder probably won't allow this. My master file is located in a non-Users folder.
    Last edited by June7; 01-08-2016 at 09:22 PM.
    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.

  14. #29
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    visaccess, what June7 posted about the red x is what I was saying way back, but your subsequent posts never gave me a warm fuzzy because I saw no evidence that you were constructing a valid path. If you did in fact used the debug suggestion, you should have posted the result to either confirm or dispel my suspicions that you were not starting at the root of any drive. Also, the comment about the FE having to be on each user's pc and being on the root of the drive is not necessarily true in your case because of IT restrictions, or certainly if your users are on thin clients. If that is the case, you will be forced to keep the base files elsewhere.

    Which leads me to why I was not able to publish my last database on each user's pc. Some were on thin clients, some were not. So
    - the base file (FE) was on a directory share and everybody used it. A network admin handled folder permissions for the database folder.
    - the working file (template) was not available to very many people; I was one of them
    - I made changes to the template, then invoked the lockout function (which used the CreateFile method to place a hidden file in the db folder). As mentioned, I cannot recall being thwarted by anyone leaving a pc in locked mode - maybe I was just lucky.
    - then I moved the shared file to a sub folder called 2Bdeleted, then I copied over the template file as a new version
    - the FE checked that the application.path was as expected, and if not, they didn't get in (to thwart those who would copy the front end to their desktop and never get updates)
    This approach may not work for you.

    As long as each user has a place to keep an FE copy, and has access to ONE location where they can get an update, you should be able to use either approach (single FE or multiple FE's). Even if your FE has to reside on the web as a downloadable file, as long as they're consistent with where it goes (or you might be able to program Access to do this automatically) you should be able to use multiple FE approach. I like the idea of comparing a form label to some BE version value.
    Last edited by Micron; 01-08-2016 at 09:00 PM. Reason: accidentally posted before completing

  15. #30
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    again thank you all for your help. sorry i didn't post an update about the debug and i have been trying all combinations i can think of including putting the Drive letter before the path string. June7, my full intentions is to put the FE on the each users computer, that's why i'm testing this one on my desktop. the difference in performance alone is a significant reason to try this. currently i'm at
    Code:
    If Me.txtversion <> Me.lblversion.Caption Then
    'copy Access file
    CreateObject("Scripting.FileSystemObject").CopyFile _
        "C:\users\myname\documents\testnew\test1.accdb","C:\", True
    'allow enough time for file to completely copy before opening
    Dim Start As Double
    Start = Timer
    While Timer < Start + 3
        DoEvents
    Wend
    I've commented out the shell below this , figured i needed to get this part before tackling it. this is kind of working but giving me a runtime error 70 permission denied so i'm sorry for doing it again but i moved back to my home computer where i could eliminate the work network and security settings.
    my FE is located on my desktop at E:\desktop\test1.accdb
    the BE is right beside it at E:\desktop\test1_BE.accdb
    the master FE is on my desktop in a separate file at E:\desktop\testnew\test1.accdb
    trying
    Code:
    If Me.txtversion <> Me.lblversion.Caption Then
    'copy Access file
    CreateObject("Scripting.FileSystemObject").CopyFile _
        "E:\Desktop\testnew\test1.accdb", "E:\", True
    'allow enough time for file to completely copy before opening
    Dim Start As Double
    Start = Timer
    While Timer < Start + 3
        DoEvents
    Wend
    this steps thru the code and closed the DB but when i reopen it nothing is updated? just to make sure i did it correctly how should i debug this path? when i did it i just set the path to a string variable and inserted that into the copyfile and debugged the variable. Micron, you mentioned having a different method that works, would you share it please.

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 11-27-2013, 09:51 AM
  2. Should i split the database
    By tagteam in forum Database Design
    Replies: 4
    Last Post: 05-20-2013, 12:04 PM
  3. Split Database
    By gbwiii in forum Database Design
    Replies: 4
    Last Post: 05-20-2011, 09:55 AM
  4. Split Database.
    By cvolkers in forum Programming
    Replies: 3
    Last Post: 09-09-2010, 11:52 PM
  5. Split Database
    By pthoopth in forum Database Design
    Replies: 3
    Last Post: 11-09-2009, 03:37 PM

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