Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Unanswered: VB Script to clone and execute mde/mdb with loginID

    The attached vb script is a script I've found extremely valueable so I thought I'd create a separate post on it. This script can be used to clone any mde/mdb/(or other file type), add the user's Windows loginID, and execute that clone file.

    Do not use this script if you have MSAccess Data tables (i.e you don't have linked MSAccess data tables or SQL Server tables.) Otherwise it will clone the MSAccess data tables as well and you'll end up with separate data tables. It's designed for frontend MSAccess mde/mdb files which have linked tables in them.

    'Read the comments in the script. You'll need to edit the vbs script (in notepad) and change the LUName which is the location of your mde/mdb file (keep the location name in " as the example illustrates.). It's recommended to use the UNC name for the location but this is not a neccessity. If you are using an mdb file instead of an mde you'll also need to change the line:
    newName = Replace(LUName, ".mde", "") & GetUser & ".mde"
    to
    newName = Replace(LUName, ".mdb", "") & GetUser & ".mdb".

    Edit the vb script with notepad to change.

    Dan Wang and myself created this script and I haven't ever had problems with it. I can only possibly see problems if perhaps your system administrator has locked a computer from running vb scripts or the wscript.exe file has not been installed (or deleted) from the Windows\System folder.

    This script has many, many advantages:

    1. Users can create a shortcut to the vb script on their desktop and just click on the short-cut (when executed, it will clone the mde/mdb file, add the users windows loginID, and automatically launch the cloned mde/mdb file with the users loginID.) It's great for multiple users getting into the same frontend mde/mdb file (with linked tables). Each user is then working off of their own MSAccess file verses multiple users in the same MSAccess file.
    2. You can copy new source mde/mdb code to the working folder without have to have all the users close out of the working mdb/mde file!
    3. You can see who is currently in the mde/mdb (i.e. you'll see a file such as MyMDEApplicationPaulK.ldb in that folder).
    4. You can tell when that user LAST got into the mde/mdb file by looking at the creation date of the mde/mdb file with the users loginID!

    I hope you find this script as useful as I have! I use it quite a bit for not just MSAcces applications, but other file types as well. If you find it useful, please send me feedback at pkohn@charter.net.
    Attached Files Attached Files
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  2. #2
    Join Date
    Aug 2006
    Posts
    559
    That may come in helpful for me on my db, well, eventually when it is fully operational.

    You know, I hope one day i will be able to accomplish what you do in Access. I even want to try to learn MySQL, SQL, Oracle and ANYTHING else I can.

    It even boggles my mind why they don't make you like a 'mod' on here.
    Last edited by Grafixx01; 05-26-07 at 11:09.

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    You are like a "mod" on here also Bryan. I see you posting your ideas onto others which makes you a valuable assett to them. Keep in mind that you're NOT working on a "beginner's" level database with your application. You've got some good advanced techniques in your database which you've passed on to help others. I learned a lot of my techniques by reading posts and books (Ken Getz - Sybex books are GREAT!) Has a lot of good examples. I didn't learn MSAccess in school (they didn't teach it back then and MSAccess was version 1.0), but instead, by looking at other people's code/examples and then a lot of trial and error. Just because I've designed hundreds of MSAccess databases doesn't mean I know everything. I learn something new at least once a week.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Even looking at the database you've designed, you've taught me as well! As Missinglinq quotes: "There are many ways to skin a cat." (although I like cats and don't like the thought of skinning one.)
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Thanks though for the suggestion of being a "mod". But I post on a lot of different forums and I don't get on this forum every day (although I think this forum is the best one out there!) You've got a LOT of experienced users on this forum! More than any other forum I've seen. Some forums also are strictly maintained by the moderator who thinks only their suggestions are the ones to use (the "god" type complex). On this forum, you've got so many different experienced users that I can't mention all of them. I have to thank a lot of them also though for they've helped me as well. The nice thing is that users have the ability to contradict others on this forum and present their ideas as well.

    If a company was based off of all the users which help other users on this forum, you'd have one heck of a company.
    Last edited by pkstormy; 05-26-07 at 12:02.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  6. #6
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Also, this forum allows you unlimited uploads which is really nice! Some of the other forums I'm on only allow me to upload a certain limit size of code. This forum is the ultimate for user help! But as the forum states, don't expect someone to write the application for someone else. There is a limit to the amount of help someone should expect. Don't you get caught where you end up designing and writing an ENTIRE application for someone else when you help them. People get paid to do that sort of thing. You should be able to expect snippets of coding help on this site though and some good examples of how to do things. (and you shouldn't have to pay to get help for a problem you're having!! - I'm very much against that sort of thing and those type of help sites.) Others might dissagree on this point but I learned from others and want others to learn from me. If I go to a site where I have to pay to see the responses, I'll simply research for an answer somewhere else.
    Last edited by pkstormy; 05-26-07 at 12:19.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  7. #7
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by Grafixx01
    It even boggles my mind why they don't make you like a 'mod' on here.
    Lol. There's no withholding. All you have to do is ask - no one comes to you and says "we want you to be a mod".

    About a year or two ago Softwarerevue (iNEt's presence on the board) asked if people wanted to become mods. About 5 or so took up the request (I was one of the last). I imagine the offer remains open. I only know from my own experience that other mods then seconded me and were given the opportuntity to "black ball". I have only seen one person refused - that person had a handful of posts and had been a member for only a few weeks. Paul certainly would not have any problem on that front.

    So anyway - like many things in life - you want something then you just have to ask.
    Last edited by pootle flump; 05-26-07 at 12:23.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  8. #8
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Paul - why not put these little apps you have in the code bank? That is a sticky and remains at the top of the forum. This one will just sink into the depths as time passes by.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  9. #9
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    OK...Thanks for info pootle flump! I keep forgetting about the code bank! and I appreciate the being "mod" response. I'll think about it. Who would I ask or where would I pose the question if I did want to become a "mod"?
    Last edited by pkstormy; 05-26-07 at 12:30.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  10. #10
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I think I made my request in suggestions & feedback. The thread was then moved to the moderators forum for discussion amongst the mods.

    I see you've popped into the code bank. I know you have lots of samples you've posted over time. All welcome
    Testimonial:
    pootle flump
    ur codings are working excelent.

  11. #11
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Thanks pootle flump!!
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  12. #12
    Join Date
    Feb 2007
    Posts
    348
    Thanks for the script. I'm about to begin experimenting with it as I need to do code updates but someone apparently just has the app open on the desktop for no reason.

  13. #13
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    I used to use something like this, fired in the startup:
    Code:
    If Mid(CurrentDB.Name, 1, 14) = "\\MyServerName" Then
    'Some message telling them off.
    DoCmd.Quit
    End If
    Obviously the Name comparison would match to the location people should download thier copy from (using code like Paul's). This ensures they open the database in the "official way" via some in house application\ script rather than opening the it directly on the server.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  14. #14
    Join Date
    Feb 2007
    Posts
    348
    I get and error:
    "The command line you used to start Microsoft Office Access contains an option that Microsoft Office Access doesn't recognize."

    It seems to generate the file but bombs out in opening it.
    Also, I'm curious, This generates a local front end to the DB. How do you make changes to all these front ends? just tell folks to delete their front end and run the script again?

    EDIT:
    It seems the bombing out had to do with the fact I was playing on my desktop and the folder that is in is "Documents and Settings" if I use a path with no spaces it works.
    Last edited by starkmann; 05-29-07 at 12:48. Reason: clarification

  15. #15
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by starkmann
    Also, I'm curious, This generates a local front end to the DB. How do you make changes to all these front ends? just tell folks to delete their front end and run the script again?
    Except the delete bit (the "True" in the below line handles that for you).
    Code:
    retval = objFSO.CopyFile(oldname, newName, True)
    Otherwise - yes. You upload the new version to the share and inform anyone who needs it NOW to close down their FE and rerun the script.
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

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