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 9466
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: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |