Page 11 of 11 FirstFirst ... 91011
Results 151 to 152 of 152
  1. #151
    Join Date
    Nov 2013

    NewName file won't open


    I attempted to use the below code as is; the db will clone but the new file will not open. I received the error 80041002. My script is below:

    'vb script created by pkstormy -- make sure to save as *.vbs extension so it can be executed.
    'Use notepad to create this and just copy/paste the code below into a notepad file. Again, save as *.vbs extension.
    'note: when saving, change *.txt to *.* files and again, save as *.vbs file (ex: MyAppName.vbs)
    'Then just have the user's double-click on the MyAppName.vbs file to execute instead of your MSAccess file.

    Set WshNetwork = CreateObject("WScript.Network")

    'Now simply grab the user's windows loginID and save to variable GetUser to use later in pasting
    GetUser = WshNetwork.UserName

    Set WshNetwork = Nothing

    'change below LUName to point to the location of your "source" MSAccess file, ideally use UNC name

    LUName = "C:\Users\10119829\Desktop\ZR53DL CLEANUP FINAL WORKING COPY 222014.accdb"

    oldname = LUName

    'change below to "accdb" or "accde" or "mdb", whichever you're using. Below simply adds the GetUser to newName variable
    'ex: PKSampleXP.mde becomes 'PKSampleXP<LoginID>.mde for newName variable

    newName = Replace(LUName, ".accdb", "") & GetUser & ".accdb"

    retval = 0
    Dim objFSO
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    'below simply copies a "source" file (oldname to newName) and pastes it
    retval = objFSO.CopyFile(oldname, newName, True)

    Set objFSO = Nothing

    Dim objShell
    Set objShell = CreateObject("Wscript.Shell") "MSAccess.exe" & newName

    Set objShell = Nothing

  2. #152
    Join Date
    Aug 2017
    United States

    DBForums Code Bank

    Haha. OK. Yeah, I played some Gears last night with Ruiner, Pin, and CapnMike. It was a blast, and I had a code. Thanks anyway though Baditch. I still appreciate the sentiment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts