Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"On Click" Error

Status
Not open for further replies.

Joshua61679

Technical User
Dec 28, 2001
36
US
I'm kind of new to VBA programming. I've been using Access for about a year, but have avoided VBA 'till now. I'm in Access2002 trying to call up an Excel2002 worksheet named "simplecasedhole.xls" in the c:\ directory when a command button is clicked. This is the code I'm using:

Private Sub Done_Click(Path As String)

Dim xlApp As Excel.Application

If Dir(Path) = "" Then
MsgBox Path & " isn't a valid path!"
Exit Sub
Else
Set xlApp = CreateObject("Excel.Application")

xlApp.Visible = True
xlApp.Workbooks.Open "C:\simplecasedhole.xls"
End If

End Sub

I'm getting an error message that says "The event On Click that you entered as the event property setting produced the following error: procedure declaration does not match description of event or procedure having same name." Any help would be much appreciated.
 
Hi!

The click procedure cannot have any parameters. What is your parameter Path and where does it come from? Maybe it it something that you can access from the procedure without needing to pass it?

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top