All,
I'm trying to move this code (which I bastardized, thanks!) from the
form where I have successfully implemented it to a Module, so I can
implement it for all of the appropriate forms in my app.
Of course, I'm getting an error because I can't use Me. in a Module.
I read the many posts explaining why I can't, but did not find an
answer as to how to resolve this.
Any suggestions?
Thanks,
Patrick
*************** *************** *************** *************** *************** *************** *************** *****
Public Sub Clear_All()
On Error GoTo Err_BTN_Clear_A ll_Click
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag <"NoDel" And TypeOf ctl Is TextBox Or TypeOf ctl Is
ComboBox Or _
TypeOf ctl Is ListBox Or TypeOf ctl Is CheckBox Then
If Left(ctl.Contro lSource, 1) <"=" Then
ctl.Value = Null
End If
End If
Next
Exit_BTN_Clear_ All_Click:
Exit Sub
Err_BTN_Clear_A ll_Click:
MsgBox Err.Description
Resume Exit_BTN_Clear_ All_Click
End Sub
*************** *************** *************** *************** *************** *************** *************** ***** 5 3698
Public Sub Clear_All(ByRef CallingForm as Form)
On Error GoTo Err_BTN_Clear_A ll_Click
Dim ctl As Control
For Each ctl In CallingForm.Con trols
If ctl.Tag <"NoDel" And TypeOf ctl Is TextBox Or TypeOf ctl
Is
ComboBox Or _
TypeOf ctl Is ListBox Or TypeOf ctl Is CheckBox Then
If Left(ctl.Contro lSource, 1) <"=" Then
ctl.Value = Null
End If
End If
Next
Exit_BTN_Clear_ All_Click:
Exit Sub
Err_BTN_Clear_A ll_Click:
MsgBox Err.Description
Resume Exit_BTN_Clear_ All_Click
End Sub
In the form module we would have a call to
ClearForm Me
BUT ... what are you trying to do here? ... it looks to me like "plans
for levitation upon painting oneself into a corner".
Thanks, Lyle!
With one minor tweak (calling Clear_All Me) your mod works dandy.
What I am doing is giving the operator a button to clear all of the
fields on a data entry form EXCEPT a few fields I don't want touched.
Works like a charm.
Patrick
On Dec 14, 12:26 pm, lyle <lyle.fairfi... @gmail.comwrote :
Public Sub Clear_All(ByRef CallingForm as Form)
On Error GoTo Err_BTN_Clear_A ll_Click
Dim ctl As Control
For Each ctl In CallingForm.Con trols
If ctl.Tag <"NoDel" And TypeOf ctl Is TextBox Or TypeOf ctl
Is
ComboBox Or _
TypeOf ctl Is ListBox Or TypeOf ctl Is CheckBox Then
If Left(ctl.Contro lSource, 1) <"=" Then
ctl.Value = Null
End If
End If
Next
Exit_BTN_Clear_ All_Click:
Exit Sub
Err_BTN_Clear_A ll_Click:
MsgBox Err.Description
Resume Exit_BTN_Clear_ All_Click
End Sub
In the form module we would have a call to
ClearForm Me
BUT ... what are you trying to do here? ... it looks to me like "plans
for levitation upon painting oneself into a corner".
Patrick A <pa*****@stradl ey.comwrote:
If ctl.Tag <"NoDel"
I'd be tempted to use an InStr function there in case you should ever decide you need
to have two tags for some controls. Highly unlikely and I've never done it yet.
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
"Tony Toews [MVP]" <tt****@teluspl anet.netwrote in
news:vo******** *************** *********@4ax.c om:
Patrick A <pa*****@stradl ey.comwrote:
> If ctl.Tag <"NoDel"
I'd be tempted to use an InStr function there in case you should
ever decide you need to have two tags for some controls. Highly
unlikely and I've never done it yet.
I think it's a bad idea to overload the .Tag property with multiple
values, kind of like denormalization . That said, the ADH has
included code for doing just that for as long as I've been using it.
--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
"David W. Fenton" <XX*******@dfen ton.com.invalid wrote:
>> If ctl.Tag <"NoDel"
I'd be tempted to use an InStr function there in case you should ever decide you need to have two tags for some controls. Highly unlikely and I've never done it yet.
I think it's a bad idea to overload the .Tag property with multiple values, kind of like denormalization .
<shrug But what else are you going to do if you ever need to?
>That said, the ADH has included code for doing just that for as long as I've been using it.
I used to look in those books a lot but haven't these last few years. I should crack
them open again.
Tny
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brandon J. Van Every |
last post by:
I'm realizing I didn't frame my question well.
What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump
up in your chair and scream "Wow! Ruby has *that*? That is SO FRICKIN'
COOL!!! ***MAN*** that would save me a buttload of work and make my life
sooooo much easier!"
As opposed to minor differences of this feature here, that feature there.
Variations on style are of no interest to me. I'm coming at this from a...
|
by: David MacQuigg |
last post by:
I'm concerned that with all the focus on obj$func binding, &closures,
and other not-so-pretty details of Prothon, that we are missing what
is really good - the simplification of classes. There are a number of
aspects to this simplification, but for me the unification of methods
and functions is the biggest benefit.
All methods look like functions (which students already understand).
Prototypes (classes) look like modules. This will...
|
by: Reed L. O'Brien |
last post by:
I see rotor was removed for 2.4 and the docs say use an AES module
provided separately... Is there a standard module that works alike or
an AES module that works alike but with better encryption?
cheers,
reed
|
by: wen |
last post by:
i have written python extend module by c/c++, but i saw a module of a
software(pyMOL, you can get it from http://pymol.sourceforge.net/) called
_cmd.pyd instead of _cmd.dll. and it is written by c/c++ also, the author
use makefile to compile it into _cmd.pyd. i have some question about it:
1. what's the difference between them? i saw the code is same as common c++
extended python module, can i use microsoft visual C++ to create a dll...
|
by: David Altemir |
last post by:
I have a table in MS Access 2003 that contains records that I would
like to copy to the end of the table. There is one slight deviation
from just doing a straightforwared COPY, however, in that I want to
append the new records using different value of column 1.
Here's an example of what I'm talking about:
Values in in Table1 before "copy" operation:
Bill, 3200 Palm Blvd
| |
by: Brett |
last post by:
I've seen few examples on the usefulness of a module. Why use a module
instead of a class?
If I put a method into Module1, how is it called from other classes?
Thanks,
Brett
|
by: Jack |
last post by:
I have a set of functions to wrap a library. For example,
mylib_init()
mylib_func()
mylib_exit()
or
handle = mylib_init()
mylib_func(handle)
|
by: xz |
last post by:
What sense do h files make in c/cpp?
I never thought about this question before.
Does the existence of h files make sense at all?
Why do we need to declare functions in h files and define/implement
them in cpp?
|
by: Joe Strout |
last post by:
I've been using docstring to exercise each of my modules, with code
like this:
def _test():
import doctest
doctest.testmod()
if __name__ == "__main__":
_test()
|
by: Flavio |
last post by:
How is this code going to look like in Python 3.0? (it's deprecated
according to http://docs.python.org/library/new.html#module-new, but
it does not tell what to use instead)
method = new.instancemethod(raw_func, None, cls)
setattr(cls, name, method)
Can we write code in python2.5/2.6 that will work in 3.0?
|
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...
| |
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: 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...
|
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: 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...
| |
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...
| |