473,663 Members | 2,694 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What happened to the CommandButton_C lick event?

stonward
145 New Member
Evening All,

Forgive me, but this question is related to my last question...

In Access 2002 I used a simple "buttonname_Cli ck" command to activate a button on a form from another form.

When I try this in version 2007, i get a 'Method or data member not found' error: although intellisense adds all the right capital letters etc. It fails on Compile too; the code doesn't need to be run.

Did anyone else us this command previously, and is there an equivilent now?

Thankyou for your patience,


Stonward
Jan 31 '13 #1
9 2308
Seth Schrock
2,965 Recognized Expert Specialist
So your sub looks like the following?

Expand|Select|Wrap|Line Numbers
  1. Private Sub ButtonName_Click()
  2.  
  3. End Sub
And when you debug the code, it selects the first line?

Try going into your button's event list in the properties window and create the event through that instead of manually typing in the code.
Jan 31 '13 #2
zmbd
5,501 Recognized Expert Moderator Expert
I find that all too often, I'll cut and paste a button code (usually the "close/exit" button) and it fails with that error; Because, you have to establish the "click" event first thru the properties dialog box. This does two things, it adds the "sub()" to the VBA editor that we're used to working with and it adds a pointer to the event within the collection.
Jan 31 '13 #3
NeoPa
32,568 Recognized Expert Moderator MVP
My first bit of advice is to avoid doing that. Never call event procedures directly from code. A maintainer is likely to get caught out.

That said, can you show us the exact code you're trying. Without it, and without your question explaining all the details fully, we are left guessing at whether or not the reference is qualified or otherwise; whether the declaration is Public or Private (If the latter then it would never have worked of course).
Jan 31 '13 #4
stonward
145 New Member
The button on the 'main' form, cmdReset has a click event attached to it and works correctly. Looking back at what I've done before, it would seem I've called 'that' (a) buttons click event from another button on the same form, where simply entering cmdReset_Click works. I thought if I qualified everything I'd be able to do the same from another form, but doesn't look like its possible.

Interesting point about calling procedures from code NeoPa - it's the sort of thing I'm always trying! I've another question now, so hopefully I'll speak to you all again soon.

Many thanks for your help; it can be a lonely place working on these projects and having someone (other than my dog) to tell is a great help!

stonward
Jan 31 '13 #5
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
You can call a click event from another form BUT you need to first modify the default code
Expand|Select|Wrap|Line Numbers
  1. Private Sub MyButtonName_Click()
  2.  
  3. End sub
to change the private to public
Expand|Select|Wrap|Line Numbers
  1. Public Sub MyButtonName_Click()
  2.  
  3. End sub
This is not enough though, you now need to fully qualify the forms like so:
Expand|Select|Wrap|Line Numbers
  1. Call Forms!Frm_Main!MyButtonName_Click
Jan 31 '13 #6
stonward
145 New Member
Thanks TheSmileyCoder. I tried making the button event public, now going to check I've done that AND fully qualified all names.

Get back to you.

Thanks again,

Stonward
Jan 31 '13 #7
stonward
145 New Member
TheSmileyCoder: spot on - that did it...make button public, make sure everything is fully named/called in the originating code. Now my listbox updates automatically!

Super Thanks,

Stonward
Jan 31 '13 #8
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
Thats good to hear. Best of luck with your project.
Jan 31 '13 #9
NeoPa
32,568 Recognized Expert Moderator MVP
I feel I need to repeat that fully specified external references are not a good idea when called from within the associated form's module. If a Me reference will work, then it really should be used in place of an external reference.
Jan 31 '13 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1287
by: JW | last post by:
Hi all, I was fine running mysql, and for some reason, after the most recent reboot of my machine, I get the following error and I try the following subsequent commands to try to figure things out: # mysql ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) # mysqld_safe
7
1814
by: Neil Zanella | last post by:
OK, this time the compiler's got me a little bit puzzled, simply because it is doing something I am not expecting. My understanding, according to the documentation of std::vector<>::resize(), is that when you specify a second argument the number of elements specified in the first argument is each in turn set to the second argument. void Foo::bar(int x) { static std::vector<int> foo; std::cout << "source: " << x << std::endl;...
2
2006
by: Lauren Wilson | last post by:
Hi folks, Just "upgraded" from A2K to A2K3. Everything is just hunky dory (so far) -- EXCEPT that the Add-in I had with A2K that auto inserts error code is no longer available in the Add-in manager or anywhere on my PC. I DO have the VSTO Access Developer Extensions installed for 2003. Anyone have a clue what happened to the Add-in? Is there another source for this Add-in? I have scoured the Microsoft web sites for
1
2282
by: Mikey | last post by:
Can somebody tell me what happened to the Source Profiler? It used to be under the Build menu in VC6, but now it's gone, and I cannot find anything in the docs that say what happened to it. The docs now only say something about atttaching a third party tool, but do not give any hints of what that might be. Can the old VC6 profiler be used with a fresh VC .Net compile (totally unmanaged code). Any advice, hints, etc appreciated.
4
3096
by: Alan Silver | last post by:
Hello, I downloaded and registered VWD Express from the MS site, and this gave me a free download of a book called "Build A Web Site Now!", which is a (very light) introduction to VWD. In the chapter on master pages, it says that adding meta data to a page is done by... Master.Page.Header.MetaData.Add("keywords", "ferrets, gibbons");
2
1268
by: Alex D. | last post by:
does any body knows what happened to the demo servers?
5
1562
by: rodchar | last post by:
hey all, what happened to being able to compile my app as Release version? thanks, rodchar
9
3709
by: jacob navia | last post by:
??? Not that I miss his posts, but somehow I find sad that somebody disappears from view and nobody gives a damm. Anybody knows what happened to him? He had lost is job, and was looking for a new one last time he appeared here.
3
2158
by: Giampaolo Rodola' | last post by:
http://groups.google.com/group/python-dev2 It seems it no longer exists. What happened?
0
8436
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
8858
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
8771
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...
0
8634
tracyyun
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...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4182
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
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1757
bsmnconsultancy
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...

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.