Evening All,
Forgive me, but this question is related to my last question...
In Access 2002 I used a simple "buttonname_Click" 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
9 2301
So your sub looks like the following? - Private Sub ButtonName_Click()
-
-
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.
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.
NeoPa 32,557
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).
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
You can call a click event from another form BUT you need to first modify the default code - Private Sub MyButtonName_Click()
-
-
End sub
to change the private to public - Public Sub MyButtonName_Click()
-
-
End sub
This is not enough though, you now need to fully qualify the forms like so: - Call Forms!Frm_Main!MyButtonName_Click
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
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
Thats good to hear. Best of luck with your project.
NeoPa 32,557
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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...
|
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...
|
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...
|
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...
|
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...
| |
by: Alex D. |
last post by:
does any body knows what happened to the demo servers?
|
by: rodchar |
last post by:
hey all,
what happened to being able to compile my app as Release version?
thanks,
rodchar
|
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...
|
by: Giampaolo Rodola' |
last post by:
http://groups.google.com/group/python-dev2
It seems it no longer exists. What happened?
|
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...
| |
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: 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...
|
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: 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...
| |