Comand Button

C

Cathy

I've entered a command button on my form where I want to search the form by
the data field named "GPC." This is the code that is attached to the button.

Private Sub Search_GPC_Click()
On Error GoTo Err_Search_GPC_Click


Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Search_GPC_Click:
Exit Sub

Err_Search_GPC_Click:
MsgBox Err.Description
Resume Exit_Search_GPC_Click

End Sub

Unfortunately, when I click the button I get the following error message.

"The expression OnClick 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 am not very familiar with code. Any help is GREATLY appreciated.
 
D

Dirk Goldgar

Cathy said:
I've entered a command button on my form where I want to search the form
by
the data field named "GPC." This is the code that is attached to the
button.

Private Sub Search_GPC_Click()
On Error GoTo Err_Search_GPC_Click


Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Search_GPC_Click:
Exit Sub

Err_Search_GPC_Click:
MsgBox Err.Description
Resume Exit_Search_GPC_Click

End Sub

Unfortunately, when I click the button I get the following error message.

"The expression OnClick 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 am not very familiar with code. Any help is GREATLY appreciated.


I don't see any reason that particular procedure should give you that
message. Maybe the error is in another Sub in the same module. Have you
tried explicitly compiling the project by clicking the Debug -> Compile menu
option in the VB Editor environment? That may highlight the specific line
of code that is in error.
 
C

Cathy

The Debug did the trick! Thanks so much!

Dirk Goldgar said:
I don't see any reason that particular procedure should give you that
message. Maybe the error is in another Sub in the same module. Have you
tried explicitly compiling the project by clicking the Debug -> Compile menu
option in the VB Editor environment? That may highlight the specific line
of code that is in error.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top