Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    New Zealand
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Control Buttons don't work (Access 97)

    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

  2. #2
    Star Lounger
    Join Date
    Nov 2001
    Location
    Illinois, USA
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Control Buttons don't work (Access 97)

    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.

  3. #3
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    New Zealand
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Control Buttons don't work (Access 97)

    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

  4. #4
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    New Zealand
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Control Buttons don't work (Access 97)

    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

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Control Buttons don't work (Access 97)

    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.
    Charlotte

  6. #6
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Control Buttons don't work (Access 97)

    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.
    Regards
    John



  7. #7
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    New Zealand
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Control Buttons don't work (Access 97)

    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! <img src=/S/clapping.gif border=0 alt=clapping width=19 height=23>

Posting Permissions

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