Results 1 to 3 of 3
  1. #1
    Join Date
    May 2013
    Posts
    2

    Question Unanswered: Access 2007 VB code

    Below is code I was trying to use to see if my Main Menu was loaded.
    I get an error message that says "the object you referred to is either closed or doesn't exist." The name is spelled corectly and the object is opem and certainly exists.
    What ame I doing wrong?
    Bill

    Private Sub Button12_Click()
    On Error GoTo Err_Button12_Click


    If CurrentProject.AllForms("main Acces Entry").IsLoaded Then
    DoCmdn Macro "MainMenu.Main Hide"
    End If
    Last edited by toughwg; 05-22-13 at 20:44. Reason: spelling error

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Does you code actually read

    DoCmd. RunMacro "MainMenu.Main Hide"

    with the Space removed, between

    DoCmd.

    and

    RunMacro?

    Or does it appear, in your code, exactly as it displays, here:

    DoCmdn Macro "MainMenu.Main Hide"

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    May 2013
    Posts
    2

    Code error message

    What I am doing here is converting an old Access 2.0 VB3 data base up to a access 2007 configuration. Access 7 will actually read the old VB3.0 code which I will upgrade after I find all the bugs. Getting along pretty good but can't figure out this one statement. Here is the entire procedure which is storted with a Click on a button on the Main Acess Entry form.

    Private Sub Button12_Click()
    On Error GoTo Err_Button12_Click

    Dim DocName As String
    If CurrentProject.AllForms("Main Acces Entry").IsLoaded Then
    DoCmd****nMacro "MainMenu.Main Hide"
    End If

    DocName = "New Production Report ARC"
    DoCmd.OpenReport DocName, A_PREVIEW

    Exit_Button12_Click:
    Exit Sub

    Err_Button12_Click:
    MsgBox Error$
    Resume Exit_Button12_Click

    End Sub

    This actually works if I take out the highlighted 2 lines. It seems that Access 2007 can recompile the old Code and run it.

    And yes, the "DoCmd****nMacro "MainMenu.Main Hide" actually does work

    The new line is something I added to see if I could identify if the "Main Access Entry" form was actually loaded. That is what I wanted to acomplish.

    I have just started this project and was wanting to take out some of the old idiosyncrasies before I really start recoding.

    Bill

Posting Permissions

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