The expression On Click you entered as the event property setting produced the following error: Procedure declaration does not match description of event or procedure having the same name.

I have the following code that's causing the title error in Access 2007:

Private Sub OpenInfo_Click()
On Error GoTo Err_OpenInfo_Click

    Dim stDocName1 As String
    Dim stDocName2 As String
    Dim stLinkCriteria As String

    stDocName1 = "Course"
    stDocName2 = "StudentInfo"
    DoCmd.OpenForm stDocName2, , , stLinkCriteria
    DoCmd.Close acForm, stDocName1

Exit_OpenInfo_Click:
    Exit Sub

Err_OpenInfo_Click:
    MsgBox Err.Description
    Resume Exit_OpenInfo_Click
   
End Sub

It's maddening!
Please let me know what should be tweaked to move beyond the error.
Thank you!
eossmaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Did you provide OpenInfo_Click as the name of the sub to call in On Click?
eossmaAuthor Commented:
no [Event Procedure] on click
eossmaAuthor Commented:
so I guess I mean yes actually.

I don't know if this helps, but I'm getting this error on a number of other events, and the error is always the same.
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Please try to explicitely provide the event sub. I can't tell whether the  name format you use is correct.
eossmaAuthor Commented:
In the properties of the command button:
-name: "OpenInfo"
-On Click: " [Event Procedure]
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Looks correct, but please use the name of the sub in "On Click" for a change.
eossmaAuthor Commented:
In the On Click event, I tried OpenInfo, and OpenInfo_Click(). Both generated the same error.

Microsoft Access can't find the object 'OpenInfo_Click().'
If 'OpenInfo_Click()' is a new macro or macro group, make sure you have saved it and that you have typed its name correctly.
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Don't type in the brackets.
eossmaAuthor Commented:
I typed "OpenInfo_Click" in the on click event, and got the same error.
eossmaAuthor Commented:
my vba code in this db stopped working. it's not just the above, it's all other too.

suggestions?
eossmaAuthor Commented:
I re-copied all my scripts from an older backup, and it works!
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
You did not compare against what has changed, I suppose?
eossmaAuthor Commented:
So I noticed that if I converted the scripts to macros, the event functioned properly. What was odd was that in 2 days the database scripts started acting up - randomly. Sometimes they would work, and sometimes they wouldn't. Since I had been in the process of "cleaning up" the scripts for a new environment and purpose, the thought occurred to me that I might have deleted something vital in the process. I created the db in 2004, so there must have been something I didn't recall that was vital.

I copied and pasted all the scripts from the old version of the db - and whalla! It works smoothly again.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eossmaAuthor Commented:
I solved my own problem!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.