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 cmdCreateTestTo olBar_Click()
On Error Resume Next
CommandBars("Te st Toolbar").Delet e
On Error GoTo ErrorFound
Dim ctl As CommandBarContr ol
Call CommandBars.Add ("Test Toolbar", msoBarTop, False, True)
Set ctl = CommandBars("Te st Toolbar") _
.Controls.Add(m soControlButton , , , , True)
ctl.OnAction = "=Screen.Active Form.OnAction_C lick"
ctl.Style = 2
ctl.Caption = "On Action"
CommandBars("Te st Toolbar").Visib le = True
ErrorFound:
If (Err.Number <> 0) Then
MsgBox "Error (" & Err.Number & ") found." _
& vbCrLf & vbCrLf & Err.Description
End If
End Sub
Private Sub OnAction_Click( )
MsgBox "OnAction button was pressed from Form1."
End Sub 3 3630
On Apr 12 2004, 05:05 pm, pw****@hotmail. com (Paul) wrote in
news:b8******** *************** ***@posting.goo gle.com: 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?
This has been a known bug since Access 97. The usual workaround is to
create a public function in a standard module that calls your forms'
methods, and call that public function from OnAction property.
You can also maintain a static long variable in your form's code and only
execute the code when the variable is even, then increment the variable by
1. Sometimes the bug causes it to execute three times, so you'd need to
use Mod 3.
--
remove a 9 to reply by email
Thanks Dimitri! I had thought about using that work around, but
didn't want to. Any word on when(if) Microsoft will fix this error?
On Apr 13 2004, 09:41 am, pw****@hotmail. com (Paul) wrote in
news:b8******** *************** ***@posting.goo gle.com: Thanks Dimitri! I had thought about using that work around, but didn't want to. Any word on when(if) Microsoft will fix this error?
Well, since it wasn't fixed in the last seven years, I wouldn't hold my
breath.
--
remove a 9 to reply by email 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: acharyaks |
last post by:
Hi Guru,
the aspx page code executing behind the controls and
functions executing twice. How can I avoid running the
code behind the controls (for example this vanishes the
control box text previously entered) when the postback
method is triggered
Page_Load{
If !(IsPstback then){
<Please tell me what I have to do to stop executing code
|
by: G.Gerard |
last post by:
Hello
Does anyone know how to write a function name with arguments in the OnAction
of a command
bar button:
Example: Public Sub MyFunction(strMsg as String)
Msgbox strMsg
|
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
|
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)
| |
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
|
by: tshad |
last post by:
I thought I understood how the SaveViewState is working and was trying to
use this (as per some code I found) to detect refreshes. It seemed to be
working but I found that the SaveViewState was executing twice on load of
page and can't figure out why.
I was writing out to a text file in the SaveViewState event and it was
writing it twice everytime a page was loaded (whether on an initial load of
the page or Postback).
I took out the...
|
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
|
by: grusso |
last post by:
well, i need a table with all functions for onaction sentence. where i can obtain? thank yourssss
|
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,...
|
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...
| |
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,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |