Page 3 of 3 FirstFirst 123
Results 31 to 36 of 36
  1. #31
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    but when i reopen it nothing is updated
    Are you looking in the right place for the new file? You are copying to E:\, not E:\Desktop where the file to be overwritten is located. Consider the security blocks you may have to deal with before going further. Permission denied sounds like you don't have the right to save to C:\, plus you also have to worry about the end user having the same problem. Then, there is the issue with copying a file from one place to another - Trusted Locations. Even on my home pc, if I copy a db from one folder to the other, I can get the warning that functionality has been disabled in the copied version. You should seek the support of your IT in setting up permissions, trusted locations, groups, or whatever else you need in order to make this work. As for the code, I just modified and tested to see what happens if I had the db open when trying to overwrite it because what I had was not meant to do that on an open file. So in the source file I coloured the detail section of the form that would enable this. In the target file, I clicked the button, then closed and reopened the form and it was now coloured. The code doesn't look that much different from what you have now, so I really think you have to deal with security issues first. However, to get a working version when you go back to work, try copying from one place to another where you are sure you have permissions on both. I also suggest that your code should loop through the forms and reports collections to see if any are open, and stop if they are. I would not gamble on what overwriting a db would do to open recordsets. It would be safer to get the user to do this and deal with any prompts that must be dealt with.

    Code:
    Private Sub cmdFileCopy_Click()
    Dim fs As FileSystemObject
    Dim SrceFile As String
    Dim TargetFile As String
    
    'Call a reusable function here to loop thru forms/reports??
    ' If function returns True, give message and exit this sub??
    ' I would then call Application.Quit after messaging they have to restart.
    
    SrceFile = "C:\Users\Mypc\Desktop\TestFileHere\Example.accdb"
    TargetFile = CurrentProject.Path & "\Example.accdb"  'file to  be replaced
    Set fs = New FileSystemObject
    fs.CopyFile SrceFile, TargetFile, True
    
    Set fs = Nothing
    End Sub

    Last edited by Micron; 01-09-2016 at 10:51 AM. Reason: restart
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  2. #32
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    In your earlier example your frontend is at E:\desktop but you copied to E:\. The destination must be E:\desktop. But if desktop means placing it on the DESKTOP, I don't know if that would work - never even tried.

    Now your code has the db filename in the destination. Look again at my original code. The destination does not include the db filename. The destination is a folder, not a file. Maybe that will make a difference.

    However, think permissions is probably the main cause of failure.

    There should be no reason to loop through db objects. The file copy does not take place when file is fully open. It only happens the NEXT time user opens the db and then only if the version numbering condition is met.
    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.

  3. #33
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    Holly Smoke, lets just say , now we're starting to make sense and see something. sure enough when i looked in my "E\:" there the file was. that's what i was trying to understand in post 20 that i didn't comprehend with nick's response in post 21, probably because i was too frustrated at that time to understand, the second drive letter is the destination of the file. guess what, altered the code, changed the backcolor in the master and it updated the backcolor and version correctly. i agree with June on this one, i have the code as a onload of a unbound start screen so no recordsets should be open yet. as for the IT problems, my intention was to get it working first in a controlled environment then take it back to the work environment and see what happens, if i see problems at least then i can go to IT department and get advice. i think now i can move on to the shell command. in the line
    Code:
    Shell SysCmd(acSysCmdAccessDir) & "MSAccess.exe " & """" & CurrentProject.FullName & """", vbNormalFocus
    how do i alter this to reopen the DB? looks like i just insert my path where currentproject.fullname is

  4. #34
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Do not change the code. Use it exactly as presented. FullName is an intrinsic constant. VBA knows what to do with it.
    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. #35
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    Got it June7, its working great. thank you all for help me. sometimes i can get bull headed about learning something new and just get too frustrated to make sense.

  6. #36
    vicsaccess's Avatar
    vicsaccess is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Apr 2015
    Posts
    451
    Update: version checker/updater is working great, added a module to get the user's ID that is logged into the network, the part of the path that was "myname" was actually the users login that is needed to save to desktop. copied the new master FE to another file, stripped it down to just a linked table of the version and the start form. compacted, zipped and emailed back to myself. love it, put the zipped version on my desktop and it downloads a full version. tested it several times and just sent to my boss to try on his computer. thank you

Page 3 of 3 FirstFirst 123
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