473,413 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

What Do I Use Instead of Me. in a Module?

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_All_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.ControlSource, 1) <"=" Then
ctl.Value = Null
End If
End If
Next

Exit_BTN_Clear_All_Click:
Exit Sub

Err_BTN_Clear_All_Click:
MsgBox Err.Description
Resume Exit_BTN_Clear_All_Click

End Sub

************************************************** ************************************************** **********
Dec 14 '07 #1
5 3667
Public Sub Clear_All(ByRef CallingForm as Form)
On Error GoTo Err_BTN_Clear_All_Click

Dim ctl As Control
For Each ctl In CallingForm.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.ControlSource, 1) <"=" Then
ctl.Value = Null
End If
End If
Next

Exit_BTN_Clear_All_Click:
Exit Sub

Err_BTN_Clear_All_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".

Dec 14 '07 #2
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_All_Click

Dim ctl As Control
For Each ctl In CallingForm.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.ControlSource, 1) <"=" Then
ctl.Value = Null
End If
End If
Next

Exit_BTN_Clear_All_Click:
Exit Sub

Err_BTN_Clear_All_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".
Dec 14 '07 #3
Patrick A <pa*****@stradley.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/
Dec 14 '07 #4
"Tony Toews [MVP]" <tt****@telusplanet.netwrote in
news:vo********************************@4ax.com:
Patrick A <pa*****@stradley.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/
Dec 14 '07 #5
"David W. Fenton" <XX*******@dfenton.com.invalidwrote:
>> 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/
Dec 15 '07 #6

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

Similar topics

54
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...
28
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...
92
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?...
1
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...
3
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...
15
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
6
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)
9
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...
1
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()
5
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 =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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,...
0
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...

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.