Connecting Tech Pros Worldwide Help | Site Map

Using OnAction

  #1  
Old January 24th, 2006, 03:05 AM
Ken
Guest
 
Posts: n/a
Please help I've been working on this for over a day.

The following code will run the GetComments function from a shortcut
menu.

.MoveFirst
Set cmb = Application.CommandBars.Add("Comments",
msoBarPopup, , True)
Do While Not .EOF
Set cbc = cmb.Controls.Add(msoControlButton)
cbc.Caption = strItem
cbc.Style = msoButtonCaption
cbc.OnAction = "GetComments"

.MoveNext
Loop


However when I try to pass a parameter to GetComments Using the
following line
cbc.OnAction = "GetComments(1)"
I get the Error message when the item is selected from the shortcut
menu.
Microsoft Access can't Run Macro of Call back Function 'GetComments(1)'


The code for the function is:
Sub GetComments(intComments As Integer)

MsgBox intComments

End Sub

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using OnAction Ken answers 6 January 26th, 2006 03:45 PM
OnAction executing twice Paul answers 3 November 12th, 2005 10:19 PM
Command bar OnAction G.Gerard answers 1 November 12th, 2005 03:05 PM
Select OnAction in ASP? Johan Christensson answers 2 July 19th, 2005 03:20 PM