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 6 9476
cbc.OnAction = "=GetComments(1)"
--
Terry Kreft
"Ken" <ke********@police.vic.gov.au> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com... 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
I thought you couldn't pass parameters to functions in the OnAction property
of the Button? I'm sure I remember reading this in the Help file years ago.
--
HTH
Stephen Lebans http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Terry Kreft" <te*********@mps.co.uk> wrote in message
news:fZ********************@karoo.co.uk... cbc.OnAction = "=GetComments(1)"
--
Terry Kreft
"Ken" <ke********@police.vic.gov.au> wrote in message news:11*********************@g43g2000cwa.googlegro ups.com... 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
Yes. When I put
=GetComments(1) in the UI dialog
the function is called and works
I'm glad I forgot that (if I ever knew it <g>).
I tried it before posting and it worked, so I posted.
--
Terry Kreft
"Stephen Lebans" <ForEmailGotoMy.WebSite.-WWWdotlebansdot...@linvalid.com>
wrote in message news:Km******************@ursa-nb00s0.nbnet.nb.ca... I thought you couldn't pass parameters to functions in the OnAction
property of the Button? I'm sure I remember reading this in the Help file years
ago. --
HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit.
"Terry Kreft" <te*********@mps.co.uk> wrote in message news:fZ********************@karoo.co.uk... cbc.OnAction = "=GetComments(1)"
--
Terry Kreft
"Ken" <ke********@police.vic.gov.au> wrote in message news:11*********************@g43g2000cwa.googlegro ups.com... 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
One of the definate advantages to getting older.
;-)
Stephen Lebans http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Terry Kreft" <te*********@mps.co.uk> wrote in message
news:iE********************@karoo.co.uk... I'm glad I forgot that (if I ever knew it <g>).
I tried it before posting and it worked, so I posted.
--
Terry Kreft
"Stephen Lebans" <ForEmailGotoMy.WebSite.-WWWdotlebansdot...@linvalid.com> wrote in message news:Km******************@ursa-nb00s0.nbnet.nb.ca... I thought you couldn't pass parameters to functions in the OnAction property of the Button? I'm sure I remember reading this in the Help file years ago. --
HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit.
"Terry Kreft" <te*********@mps.co.uk> wrote in message news:fZ********************@karoo.co.uk... > > cbc.OnAction = "=GetComments(1)" > > > -- > > Terry Kreft > > > "Ken" <ke********@police.vic.gov.au> wrote in message > news:11*********************@g43g2000cwa.googlegro ups.com... >> 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 >> > >
Yes, the pause ..., before pronouncing your wise and considered opinions.
It's like ducks on a pond, underneath your brain is busily scrambling about
trying to remember what the question was, never mind deciding whether you
have a response <g>.
--
Terry Kreft
"Stephen Lebans" <ForEmailGotoMy.WebSite.-WWWdotlebansdot...@linvalid.com>
wrote in message news:6z******************@ursa-nb00s0.nbnet.nb.ca... One of the definate advantages to getting older. ;-)
Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit.
"Terry Kreft" <te*********@mps.co.uk> wrote in message news:iE********************@karoo.co.uk... I'm glad I forgot that (if I ever knew it <g>).
I tried it before posting and it worked, so I posted.
--
Terry Kreft
"Stephen Lebans"
<ForEmailGotoMy.WebSite.-WWWdotlebansdot...@linvalid.com> wrote in message news:Km******************@ursa-nb00s0.nbnet.nb.ca... I thought you couldn't pass parameters to functions in the OnAction property of the Button? I'm sure I remember reading this in the Help file years ago. --
HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit.
"Terry Kreft" <te*********@mps.co.uk> wrote in message news:fZ********************@karoo.co.uk... > > cbc.OnAction = "=GetComments(1)" > > > -- > > Terry Kreft > > > "Ken" <ke********@police.vic.gov.au> wrote in message > news:11*********************@g43g2000cwa.googlegro ups.com... >> 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 >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Johan Christensson |
last post by:
Hi.
I'm woundering if it's possibel to transfer a OnAction value from a
drop-down box in an ASP page without having to use Java code?
I mean something like this:
<%
Sub resposeprocess
|
by: rawCoder |
last post by:
Hi All,
I have a *.cer file, a public key of some one and I want to encrypt some
thing using this public key.
Can someone point me to a sample code for Encrypting some file using...
|
by: Mike |
last post by:
When trying to compile (using Visual Web Developer 2005 Express Beta;
frameworkv2.0.50215 ) the source code below I get errors (listed below due to
the use of ICallBackEventHandler. Ultimately I...
|
by: Paul |
last post by:
This is MS Access 2002. I am creating some custom buttons on a
CommandBar for a form. Below is the code. It works fine except that
the OnAction procedure is executed twice. Why? How can I fix...
|
by: Ken |
last post by:
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",...
| |
by: Vincent |
last post by:
I was wondering if the CommandBarButton OnAction property would allow
you to specify a function from a module to be called. According to the
post made by Turtle in 1998, the OnAction property can...
|
by: ApexData |
last post by:
I have a ShortCutMenu that is made available on the RightClick of the
mouse. The OnAction property has my custom function:
=ComboBoxEditor()
I believe that, in the ONAction property, I could do...
|
by: JDeats |
last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting
and decrypting a file.
http://support.microsoft.com/kb/307010
In .NET 2.0 this approach is not fully supported (a .NET 2.0...
|
by: grusso |
last post by:
well, i need a table with all functions for onaction sentence. where i can obtain? thank yourssss
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |