474,034 Members | 1,897 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using OnAction

Ken
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.Com mandBars.Add("C omments",
msoBarPopup, , True)
Do While Not .EOF
Set cbc = cmb.Controls.Ad d(msoControlBut ton)
cbc.Caption = strItem
cbc.Style = msoButtonCaptio n
cbc.OnAction = "GetComment s"

.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(int Comments As Integer)

MsgBox intComments

End Sub

Jan 24 '06 #1
6 9546

cbc.OnAction = "=GetComments(1 )"
--

Terry Kreft
"Ken" <ke********@pol ice.vic.gov.au> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.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.Com mandBars.Add("C omments",
msoBarPopup, , True)
Do While Not .EOF
Set cbc = cmb.Controls.Ad d(msoControlBut ton)
cbc.Caption = strItem
cbc.Style = msoButtonCaptio n
cbc.OnAction = "GetComment s"

.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(int Comments As Integer)

MsgBox intComments

End Sub

Jan 24 '06 #2
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*********@mp s.co.uk> wrote in message
news:fZ******** ************@ka roo.co.uk...

cbc.OnAction = "=GetComments(1 )"
--

Terry Kreft
"Ken" <ke********@pol ice.vic.gov.au> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.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.Com mandBars.Add("C omments",
msoBarPopup, , True)
Do While Not .EOF
Set cbc = cmb.Controls.Ad d(msoControlBut ton)
cbc.Caption = strItem
cbc.Style = msoButtonCaptio n
cbc.OnAction = "GetComment s"

.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(int Comments As Integer)

MsgBox intComments

End Sub


Jan 26 '06 #3
Yes. When I put
=GetComments(1) in the UI dialog
the function is called and works

Jan 26 '06 #4

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.co m>
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*********@mp s.co.uk> wrote in message
news:fZ******** ************@ka roo.co.uk...

cbc.OnAction = "=GetComments(1 )"
--

Terry Kreft
"Ken" <ke********@pol ice.vic.gov.au> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.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.Com mandBars.Add("C omments",
msoBarPopup, , True)
Do While Not .EOF
Set cbc = cmb.Controls.Ad d(msoControlBut ton)
cbc.Caption = strItem
cbc.Style = msoButtonCaptio n
cbc.OnAction = "GetComment s"

.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(int Comments As Integer)

MsgBox intComments

End Sub



Jan 26 '06 #5
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*********@mp s.co.uk> wrote in message
news:iE******** ************@ka roo.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.co m>
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*********@mp s.co.uk> wrote in message
news:fZ******** ************@ka roo.co.uk...
>
> cbc.OnAction = "=GetComments(1 )"
>
>
> --
>
> Terry Kreft
>
>
> "Ken" <ke********@pol ice.vic.gov.au> wrote in message
> news:11******** *************@g 43g2000cwa.goog legroups.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.Com mandBars.Add("C omments",
>> msoBarPopup, , True)
>> Do While Not .EOF
>> Set cbc = cmb.Controls.Ad d(msoControlBut ton)
>> cbc.Caption = strItem
>> cbc.Style = msoButtonCaptio n
>> cbc.OnAction = "GetComment s"
>>
>> .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(int Comments As Integer)
>>
>> MsgBox intComments
>>
>> End Sub
>>
>
>



Jan 26 '06 #6
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.co m>
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*********@mp s.co.uk> wrote in message
news:iE******** ************@ka roo.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.co m> 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*********@mp s.co.uk> wrote in message
news:fZ******** ************@ka roo.co.uk...
>
> cbc.OnAction = "=GetComments(1 )"
>
>
> --
>
> Terry Kreft
>
>
> "Ken" <ke********@pol ice.vic.gov.au> wrote in message
> news:11******** *************@g 43g2000cwa.goog legroups.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.Com mandBars.Add("C omments",
>> msoBarPopup, , True)
>> Do While Not .EOF
>> Set cbc = cmb.Controls.Ad d(msoControlBut ton)
>> cbc.Caption = strItem
>> cbc.Style = msoButtonCaptio n
>> cbc.OnAction = "GetComment s"
>>
>> .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(int Comments As Integer)
>>
>> MsgBox intComments
>>
>> End Sub
>>
>
>



Jan 26 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1549
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
2
5981
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 X509Certificate ( *.cer file ) so that it can be used to email as attachment. The real part is Encrypting using X509Certificate and CryptoServiceProvider.
1
567
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 want to use a callback from the client side to update webcontrols based on user input without using postback. I am seeking a way to stop the compile errors. using System; using System.Data;
3
3630
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 this? Private Sub cmdCreateTestToolBar_Click() On Error Resume Next CommandBars("Test Toolbar").Delete On Error GoTo ErrorFound
0
428
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", msoBarPopup, , True) Do While Not .EOF Set cbc = cmb.Controls.Add(msoControlButton)
4
8301
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 only specify a macro name. Is this still the case? I agree with Turtle that "this is pretty funky." -Vincent From: Turtle - view profile Date: Sat, Nov 21 1998 4:00 am
1
2162
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 something like this to allow or prohib the use of the function??? =iif(blnUseThis,ComboBoxEditor(),Msgbox "NotAvailable") Is there a way to enable or disable the actual menu option from even showing on the rightclick of the mouse. For example
3
8336
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 build with these methods, will appear to encrypt and decrypt, but the resulting decrypted file will be corrupted. I tried encrypting a .bmp file and then decrypting, the resulting decrypted file under .NET 2.0 is garbage, the .NET 1.1 build works...
2
2608
by: grusso | last post by:
well, i need a table with all functions for onaction sentence. where i can obtain? thank yourssss
0
10521
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10324
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
12117
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11590
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11969
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10293
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6804
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5387
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 we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.