• Event Procedures

    Author
    Topic
    #466536

    I have a database that unforunately was not planne dout very well because with all of the changing needs of the company, things were added and dropped a lot. I would like to start the new year out with a clean database, which only used the tables, queries and forms that are currently in use. I’ve started a new database and have imported everything that I need. None of the command buttons on the forms are working though. Is there something that I have to do to copy all of the event procedures over also?

    I’ve tried to copy and paste some of the command code from the old database but it says, “The action will reset your project, proceed anyway? I click okay and then is says, “Can’t perform requested operation.

    I’ve gone to a blank new form and this is what I get when I try to add a close button.

    The expression On Click you entered as the event property setting produced the following error: Error accessing file. Network connection may have been lost.
    *The expression may not result in the name of the macro, the name of a user-defined function, or [Event Procedure].
    *There may have been an error evaluating the function, event, or macro.

    I’m currently on the network so every thing seems to be working fine there…not sure what this means or why none of my events are working…

    Any assistance you can offer will be appreciate.

    Viewing 5 reply threads
    Author
    Replies
    • #1208748

      It sounds like you may have an issue with the VBA project in your old database, but it also sounds like something odd happened with the importing of forms. Importing a form should bring in the code for any forms that use event procedures. I take it you created a new empty database, but it is important to know what version of Access you are using – 2007 in particular introduces a number of new wrinkles. When I encounter this sort of situation, I try going to the old database and exporting forms one at a time to see if I find one that is corrupted. Another strategy is to import half the forms and see if things seem to work for those forms. Then try half of the remaining forms, etc. It’s tedious at best, but beats designing a new form from scratch. If all else fails you may have to do that however. Another question – is your database split, and if so what is the back-end – Access, SQL Server, or …?

    • #1208751

      I’m using Access 2000. I have not split the database.

      I tried exporting a group of forms and the command buttons still aren’t working. I imported the tables and queries though. Was that okay?
      When down to one of the on click event procedures to see if there was anything there and the screen is blank. (screen shot attached) Perhaps there is something that I need to turn on. I just don’t know!

      I’m not sure where to go from here.

    • #1208819

      Yikes, sorry to hear this. Here are some suggestions, hope they help. (BTW, you referenced an attached screen shot but I didn’t see one).

      * Make sure you’re not dealing with a networked copy of the app that people are accessing. Make sure you have exclusive access to the app.

      * Try DECOMPILING the app:

        [*] Make a copy of the mdb file while Access is not running
        [*]Compact the database: Tools | Database Utilities | Compact
        [*]Close Access. Open a command prompt, and enter something like this. It is one line, and include the quotes:
        “C:Program FilesMicrosoft OfficeOfficeMSAccess.exe” /decompile “C:My DocumentsMyDatabase.mdb”
        [*]Compact again
        [*]Try your import/export again

      * Read this KB article carefully. You MUST make sure ALL computers have the latest service packs.

      * Import it into Access 2003 and hope it transfers everything properly

    • #1208873

      Sorry, I’m pretty lost.

      Working first with your post, #3 How do I “Open a command prompt? Is that in explorer? If so, am I correct in assuming, I’ll be changing the last part to: N:My DocumentsProjectsAccessQuoteTest Areadb3.mdb, which is the location of my database?

      Trying to understand the link…Resolution #2 I don’t know how to “save the code behind the form…” Actually none of it was very clear but it might make more sense once I see how to save the code…

    • #1208874

      No worries. This can be very confusing. Regarding the decompile, just make sure you’re working with a COPY of the Access app, which it seems you are given that one of your folders is named “Test Area.”

      To get to a command prompt, click Start, Run, then type “cmd” and press Enter. You should now be at a DOS command prompt.
      You want to enter the following:
      /decompile
      Thus, in your case, you should enter the following, including the quotes, assuming Access/Office is installed in the normal place (if not, modify the first path as needed):

      “C:Program FilesMicrosoft OfficeOfficeMSAccess.exe” /decompile “N:My DocumentsProjectsAccessQuoteTest Areadb3.mdb”

      You can actually paste the whole string into your DOS window. Just click on the little icon in the upper left corner of the DOS window, click Edit, then Paste. Once done, try importing the objects from the decompiled file (db3.mdb) into a new database. (Note, just type Exit at the DOS prompt to close the window.)

      When you import objects into a new database, the code behind the forms should just be there. You shouldn’t need to do anything special to save the code. Make sure you import all the Module objects (if any) in case the code resides there. The other gentleman was correct: if you import objects and the code is missing, something is terribly wrong. This seems to be a known issue with earlier, unpatched versions of Access 2000, so make sure you have all the latest updates.

    • #1208884

      Another way to achieve the same result is to create a desktop shortcut with the /decompile switch.

        [*]Create a desktop shortcut to the db by right clicking on it and choose “Send to desktop”[*]If you right click on this new shortcut , and look at its properties, you will see a Target. Initially the Target will just have the path to the database.[*]Edit the target by putting in the full path to Access before it, and also the /decompile switch. I put that at the end so it is easy to see that it is there.
      Code:
      "C:Program Files (x86)Microsoft OfficeOffice12MSACCESS.EXE" D:johnAccesssamplessample.mdb /decompile

      NB The path to Access will depend on the version of Access and the version of Windows.

    Viewing 5 reply threads
    Reply To: Event Procedures

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: