run time error 2046

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CD Tom
    Contributor
    • Feb 2009
    • 495

    run time error 2046

    I had to rebuild my laptop, I've reloaded my Access 2007 restored my database and program, I've checked all the references and have setup the trust locations. But when I go to open one of the forms I get this error 2046 with the message The command or action "gotorecord " isn't available now. Does anybody know what I'm missing that would give me this error. If you need further information let me know.
    Thanks for any help.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Do you have any Code residing in any of the Form's Events, specifically: Open(), Load(), Current()?

    Comment

    • CD Tom
      Contributor
      • Feb 2009
      • 495

      #3
      Yes the code is in the Open() event
      Code:
      DoCmd.GoToRecord , , acNewRec
      I have the program on my desktop computer and the same program works great on it. I just copies the program and the database from the desktop to the laptop after I installed the Access 2007 program.

      Comment

      • dsatino
        Contributor
        • May 2010
        • 393

        #4
        Check your references in the VBA editor for anything 'missing'.

        Comment

        • CD Tom
          Contributor
          • Feb 2009
          • 495

          #5
          I've checked the references and there are no errors. That was the first thing I checked when I got this error. I've also check the trust locations to make sure everything is setup there. I have this running on another computer and I checked the references there to the references on the laptop and everything is the same.

          Comment

          • Mihail
            Contributor
            • Apr 2011
            • 759

            #6
            Check the database (the file) again.
            Maybe the file has a "Read Only" attribute.
            That happen if you use Nero (for example) to burn a CD then copy the information from the CD in the PC.

            Comment

            • CD Tom
              Contributor
              • Feb 2009
              • 495

              #7
              I've also checked that and it's not read only, I've also check the permissions to make sure that everything was allowed. Like I said I've checked the laptop against the desktop where it is running and everything looks the same. I'm at a loss

              Comment

              • dsatino
                Contributor
                • May 2010
                • 393

                #8
                Well, I guess if it isn't 'available now', see if it's available later.

                Try moving it out of the open and into the current() event.

                Comment

                • CD Tom
                  Contributor
                  • Feb 2009
                  • 495

                  #9
                  Ok I tried your suggestion and moved the open event to the current event I got other errors but the docmd worked. I then when ahead and moved the statements back to the Open event and guess what!!! Everything is now working. So just by removing the Open event and then setting it back up fixed what ever problem there was. I don't understand but everything is now working. At least everything I've tested. Thanks for all your help

                  Comment

                  • dsatino
                    Contributor
                    • May 2010
                    • 393

                    #10
                    just out of curiousity, is the file type .mdb or .accdb?

                    Comment

                    • CD Tom
                      Contributor
                      • Feb 2009
                      • 495

                      #11
                      The program is Access 2007 and the application is the accdb.

                      Again thanks for all your help. I wish I understood why just removing the Open event and then setting it back up again did the trick.

                      Comment

                      • dsatino
                        Contributor
                        • May 2010
                        • 393

                        #12
                        Well, during these events (open, load, etc) the program is running certain processes. By allowing programmers access to these events, the program is allowing us to add additional processes in. My guess is that there is some sort of additional information that allows your add-in to the process to be run and that information was lost. By killing your piece and then re-creating it, you re-created the lost info as well.

                        Comment

                        • CD Tom
                          Contributor
                          • Feb 2009
                          • 495

                          #13
                          Well that makes sense, again I've learned something new. Next time I have a funny problem I'll try the redoing the process. Again thanks.

                          Comment

                          Working...