Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296

    Is it possible to retrieve vba from another DB?

    Allow me to preface this by saying I am developing this all on a remote desktop so I am hoping that has nothing to do with it.
    I am trying to write my own database version checker/updater and I reached the point where I am trying to get the version number from the other database.
    This is how I planned to check
    Code:
        Set dbMain = dao.OpenDatabase("C:\TestFolder\TestDB.mdb", , True)
        strMainVer = dbMain!Modules!VersionFunctions.Lines(4, 1)
    but upon running it, that second line produces a 3734 runtime error.
    What am I doing wrong? Appreciate any help.



    My idea is to have the version number commented inside of a module called "VersionFunctions" and to check that version number against the current one.
    If they aren't the same then it prompts for update and will run a query to copy and replace all the forms and modules.
    It's a bit of an R&D/Learning project.

    Thanks for any help!

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    what is the description for error 3734?

  3. #3
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Quote Originally Posted by CJ_London View Post
    what is the description for error 3734?
    Apologies. It is "The database has been placed n a state by user 'Admin' on machine '(the name of our server)' that prevents it from being opened or locked."
    I think using "OpenDatabase" is locking it as when the error is up it has a .ldb generated.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    I think you are right..

    If by version number you mean the current version of the app, then depending on requirements I store the version number as a custom property of the db or in a table. You can even use the easily accessible application title in options>current database - using something like 'myDatabase v1.2'

    You might find this easier than storing it as some text in a module. The implication of what you are doing is providing users with a .accdb, which makes it easy for them to mess around with it (hiding the navigation pane, ribbon etc is easily overcome). Ideally you should provide a .accde - in which case the version number would not be accessible in a module anyway.

  5. #5
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Quote Originally Posted by CJ_London View Post
    I think you are right..

    If by version number you mean the current version of the app, then depending on requirements I store the version number as a custom property of the db or in a table. You can even use the easily accessible application title in options>current database - using something like 'myDatabase v1.2'

    You might find this easier than storing it as some text in a module. The implication of what you are doing is providing users with a .accdb, which makes it easy for them to mess around with it (hiding the navigation pane, ribbon etc is easily overcome). Ideally you should provide a .accde - in which case the version number would not be accessible in a module anyway.
    I will look into this method! Although my company already practices the poor method of using .accdb partially because a lot of the computers run access 2000. That is why in my string it is .mdb and not .accdb and I personally couldn't find a way to make de files for older versions of access. So chances are that I will be handing out a .mdb and just hiding the ribbon etc.

    Anyways! Do you perhaps know of a way to do what I am attempting to do or what I am doing wrong in trying to achieve it?

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Older versions use mde, not accde and each are created in the same fashion. As suggested, put the version info in its own table and consider saving the file as mde. Easier to access and edit table info than it is to modify custom db properties IMO. Your code project must be able to be compiled or attempting to create mde or accde will fail.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    Edgar is online now Competent Performer
    Windows 8 Access 2016
    Join Date
    Dec 2022
    Posts
    274
    This reply won't help manipulate vba code in external files.

    If all you want to do is notify your users that there's an update, why not using some web service?. It's just a possibility and it's very likely that you won't have to pay for just this. I mean, you could have the version check in Firebase, make access check the newest entry and compare. Then if there's a new entry, trigger the download. No code required on the web part.

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Anyways! Do you perhaps know of a way to do what I am attempting to do or what I am doing wrong in trying to achieve it?
    you can try this link - https://answers.microsoft.com/en-us/...d-6c03a4a98182

    Another alternative is to include the other db as a reference file, but you would have to store the version value in a function in a general module

    Code:
    public function Version() as string
        Version="Version 1"
    end function

  9. #9
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,938
    Seems a very complicated way of doing this?
    Every time you have a new version you have to edit a module?

    I just used Bob Larsen's Auto Updater and added a table that logged the changes per version.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  10. #10
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Quote Originally Posted by Micron View Post
    Older versions use mde, not accde and each are created in the same fashion. As suggested, put the version info in its own table and consider saving the file as mde. Easier to access and edit table info than it is to modify custom db properties IMO. Your code project must be able to be compiled or attempting to create mde or accde will fail.
    I will have to look into how to make and mde file then! It would be nice to have. I hope I don't have to install anything though because they don't give me permission to install stuff to the remote desktop.
    Quote Originally Posted by Edgar View Post
    This reply won't help manipulate vba code in external files.

    If all you want to do is notify your users that there's an update, why not using some web service?. It's just a possibility and it's very likely that you won't have to pay for just this. I mean, you could have the version check in Firebase, make access check the newest entry and compare. Then if there's a new entry, trigger the download. No code required on the web part.
    I am trying to avoid using outside sources. I want to keep it as self contained as possible.
    Quote Originally Posted by CJ_London View Post
    you can try this link - https://answers.microsoft.com/en-us/...d-6c03a4a98182

    Another alternative is to include the other db as a reference file, but you would have to store the version value in a function in a general module

    Code:
    public function Version() as string
        Version="Version 1"
    end function
    I think I am going to go with one of your earlier methods after sleeping on it.
    I think the best one would be to change the Database number in the DB options and have it go off that. I just need to figure out how I want it to work. I had planned for it to do an update without closing out Access and copying files but that isn't possible if I make an mde. I'm not even sure how to do it if I don't make it an mde so I may just making users copy the db manually with a prompt saying there's an update.
    Quote Originally Posted by Welshgasman View Post
    Seems a very complicated way of doing this?
    Every time you have a new version you have to edit a module?

    I just used Bob Larsen's Auto Updater and added a table that logged the changes per version.
    Well the idea is to not ever have to update it ideally but I was going off of a similar method I saw in some betterdiscord plugins. They comment the version at the top of the plugin file and use that for checking the version.
    I am trying to keep it self-contained so that I don't need another tool and using it as a learning experience for the future as well.
    If I don't come up with a way to do this we end up just having a folder on our network with several copies of the frontend and shortcuts get placed on users desktops. Then if I need to update it I have to update all of them.
    They end up just getting named like "Database_BuildingLocation_User"

    My original plan which it seems I have to scrap was to create a module that only has the functions to check for updates. When it detects an update it generates a query(or there would be one packaged with it) that will copy and replace all objects and modules.





    After all this talk I am now thinking (hypothetically) how would I create a program (in another language) that only retrieves the new changes.
    Like how to make it so it only updates the lines it knows changed, but this is irrelevant to this discussion/access.

  11. #11
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,938
    You copy the FE. That is it.
    Some people only supply a batch file that copies the master FE every time the db needs to be opened.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  12. #12
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    we end up just having a folder on our network with several copies of the frontend and shortcuts get placed on users desktops.
    not a good idea. It's OK to share the BE (tables only) via a FE but not OK to share a FE - it leads to all sorts of potential problems including corruption.

    Plenty of examples out there as how to distribute a FE to each user.

  13. #13
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Quote Originally Posted by Welshgasman View Post
    You copy the FE. That is it.
    Some people only supply a batch file that copies the master FE every time the db needs to be opened.
    Interesting. I wonder if I could have a batch file that would check the DB version and just copy the new version if new, else open the current.
    I will most likely end up just doing the copying and renaming. (or potentially learn to write a batch file that cycles through the folder and stores the name of the file before copying the master and renaming it to the stored value.)

    I just wanted to take a stab at trying to write my own update program and learn what I could from it. I appreciate all the info and welcome any more comments on things.

    Quote Originally Posted by CJ_London View Post
    not a good idea. It's OK to share the BE (tables only) via a FE but not OK to share a FE - it leads to all sorts of potential problems including corruption.

    Plenty of examples out there as how to distribute a FE to each user.
    I think this situation is a bit different than what you are thinking.
    I am talking about the same tool as in this thread https://www.accessforums.net/showthread.php?t=87825
    Essentially this is going to be a tool for just marking orders complete in the SQL server but has to update a few different tables (and a couple of other functions etc)
    It is going to be opened on several computers at a time.
    I am trying to avoid using the system I mentioned (Network folder with named frontends for every user and the users have shortcuts that point to those) by finding a way to auto update with version numbers.
    But we seem to have come to the conclusion its best/quickest/easiest to use the network folder shortcut method.

    What I mean by a batch file that copies and renames is I write a loop that copies the name of the FE its on. deletes it and copies the newer version and renames it. That way the shortcut would still work and I can just call and make sure everyone is out before I run the batch (or write a check for ldb files of the same name).
    This method would work especially if I use .mde's for distrobution.

    (My company already uses this method for a different DB and they are .mdb files. just no batch file. I have an excel sheet where I keep track to make sure everyone is updated and its really ineffecient and theres some data stored in the frontend somewhere that makes it so I can't just copy and paste the update. I didn't make this one.)

    I hope this clarifies? If it is what you were already thinking then I am not sure how it would cause potential problems and corruption? The whole Tool/Frontend uses passthrough queries to retrieve and update information and has a lot of error checking.

    (P.S. Sorry for long text)

  14. #14
    Edgar is online now Competent Performer
    Windows 8 Access 2016
    Join Date
    Dec 2022
    Posts
    274
    How are you going to orchestrate the update?

  15. #15
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Quote Originally Posted by Edgar View Post
    How are you going to orchestrate the update?
    If I use the batch method it shouldn't be hard. It's a small enough company I can call 2-3 people and get everyone to close it out for 5 minutes.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Retrieve Day Number From Day Name
    By DMT Dave in forum Access
    Replies: 3
    Last Post: 02-17-2020, 06:21 AM
  2. Retrieve entered value
    By zipaway in forum Programming
    Replies: 3
    Last Post: 06-10-2014, 08:53 AM
  3. retrieve Column Name
    By drunkenneo in forum Queries
    Replies: 6
    Last Post: 10-31-2013, 11:50 PM
  4. retrieve value from another form
    By joshynaresh in forum Forms
    Replies: 4
    Last Post: 10-27-2013, 03:39 AM
  5. ADODB Retrieve Value with SQL Help
    By kawi6rr in forum Programming
    Replies: 3
    Last Post: 05-07-2011, 02:03 PM

Tags for this Thread

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