• Control Buttons don’t work (Access 97)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Control Buttons don’t work (Access 97)

    Author
    Topic
    #373028

    I made a database in Access 2000 at home, converted it to Access 97 to use at work, and now (at work) most of the command buttons don’t function. I get the error message “The expression may not result in the name of a macro, the name of a user defined function, or Event Procedure…”
    No modules or functions have the same name.
    I tried re-making the buttons with the wizard in Access 97, but they don’t work either.

    Here is a sample of the code for one button:

    Private Sub btnViewAmendments_Click()
    On Error GoTo Err_btnViewAmendments_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = “frmAmendment”

    stLinkCriteria = “[Trial_Number]=” & “‘” & Me![Trial_number] & “‘”
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit_btnViewAmendments_Click:
    Exit Sub

    Err_btnViewAmendments_Click:
    MsgBox Err.Description
    Resume Exit_btnViewAmendments_Click

    End Sub

    Any ideas on what I am doing wrong?

    Thanks

    Viewing 3 reply threads
    Author
    Replies
    • #598129

      Sometimes even though your event procedures are correctly named to match the name of your control and its event, a disconnect somehow occurs. For your btnViewAmendments command button, if you look at the events tab of its properties window, does it show that there is code for the Click event or not? If not, you just have to click next to the event name in the property list as if you were going to enter new code and that should hook it back up correctly.

      • #598133

        I looked at the properties for the command button. At the On Click [Event Procedure], the “…” correctly leads to the code for “Private Sub btnViewAmendments_Click()”, as listed in my first posting.
        The button still delivers up the error message.
        Thanks anyway, Dottie

    • #598134

      New finding: if I make a new form, and then make a command button to open the Amendment form at a certain record, it works. This implies there is something wrong with the original form. Both old and new forms are based on the same table.
      The original form is large and complex – I don’t want to re-make it. Any ideas on how to fix it?
      Thanks again

      • #598137

        Did you check to make sure you have the DAO 3.51 object reference set in your Access 97 version? If the old form has become corrupted, try copying all the controls from the old form to a new form. See if the form itself works properly. If it does, export the code module behind the form to a text file. The open the new form’s module and import the text file into it. If the form works after that, the old module may be been corrupted. If it *doesn’t* work, then you’ve got something from a later version that doesn’t work in A97 and you’ll have to track it down and change it.

    • #598142

      Another tactic that sometimes fixes strange error behaviour is to make a new blank database, and then import everything out of the old database into the new one.

    • #599011

      Problem solved! Made a new form and copied all the old controls onto it. Copied and pasted the code as suggested.
      Thanks for the help! clapping

    Viewing 3 reply threads
    Reply To: Control Buttons don’t work (Access 97)

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

    Your information: