Dim Found, MyObject, MyCollection
Found = False ' Initialize variable.
For Each MyObject In MyCollection ' Iterate through each element.
If MyObject.Text = "Hello" Then ' If Text equals "Hello".
Found = True ' Set Found to True.
Exit For ' Exit loop.
End If
Next
Is it possible for MyCollecion to be the set of records in
tblChkImageFile Names and how would I modify the above code
to do something For Each [CIFNID] field value in MyCollection?
If I'm way off-base here, I'll just use DAO. 8 1379
A set of records (i.e. a recordset) is not the same thing as a collection.
Use a DAO.Recordset.
It sounds like you know how to do that, but here's an example just in case: http://allenbrowne.com/func-DAO.html...cordsetExample
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"MLH" <CR**@NorthStat e.netwrote in message
news:je******** *************** *********@4ax.c om...
Dim Found, MyObject, MyCollection
Found = False ' Initialize variable.
For Each MyObject In MyCollection ' Iterate through each element.
If MyObject.Text = "Hello" Then ' If Text equals "Hello".
Found = True ' Set Found to True.
Exit For ' Exit loop.
End If
Next
Is it possible for MyCollecion to be the set of records in
tblChkImageFile Names and how would I modify the above code
to do something For Each [CIFNID] field value in MyCollection?
If I'm way off-base here, I'll just use DAO.
MLH <CR**@NorthStat e.netwrote in news:jepdd39jeu b25srjq4bm0hnuj od7hmodak@
4ax.com:
If I'm way off-base here, I'll just use DAO.
Good idea! That's what most people who are way off-base use.
he! he! he!
--
lyle fairfield
Ceterum censeo Redmond esse delendam
If you would describe what you have and what you are trying to accomplish,
it's more likely that someone could make a useful suggestion. It does not
seem useful to create a Collection to house a Recordset. And, for example,
I think the probability rather high that you don't want to Dim those three
variables all as variants, which is what the first line of your code does.
Larry Linson
Microsoft Access MVP
"MLH" <CR**@NorthStat e.netwrote in message
news:je******** *************** *********@4ax.c om...
Dim Found, MyObject, MyCollection
Found = False ' Initialize variable.
For Each MyObject In MyCollection ' Iterate through each element.
If MyObject.Text = "Hello" Then ' If Text equals "Hello".
Found = True ' Set Found to True.
Exit For ' Exit loop.
End If
Next
Is it possible for MyCollecion to be the set of records in
tblChkImageFile Names and how would I modify the above code
to do something For Each [CIFNID] field value in MyCollection?
If I'm way off-base here, I'll just use DAO.
You're right, Larry. I was just phishing for thoughts. I think Allen's
response the most helpful, indicating that a Collection is not useful
for manipulating or referring to a Recordset. I've never had a use
for Collections and was wondering if anyone used them in that way.
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx
On Sat, 01 Sep 2007 06:52:50 GMT, "Larry Linson"
<bo*****@localh ost.notwrote:
>If you would describe what you have and what you are trying to accomplish, it's more likely that someone could make a useful suggestion. It does not seem useful to create a Collection to house a Recordset. And, for example, I think the probability rather high that you don't want to Dim those three variables all as variants, which is what the first line of your code does.
Larry Linson
Microsoft Access MVP
"MLH" <CR**@NorthStat e.netwrote in message
news:dc******** *************** *********@4ax.c om...
You're right, Larry. I was just phishing for thoughts. I think Allen's
response the most helpful, indicating that a Collection is not useful
for manipulating or referring to a Recordset. I've never had a use
for Collections and was wondering if anyone used them in that way.
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx
The only time I created my own collection was when I was exploring the
subject... and, like you, I never quite found a use.
I didn't do comparative timings, but there might be some population where
using a collection and retrieving the members by name, then using some other
property, would be more efficient than arrays, searching and sorting to
retrieve the item, etc.
This approach works, but whether it's "better" or "faster," I couldn't say.
And, the requirement does not arise frequently enough, for me, to warrant
in-depth testing.
Larry
Good to explore.
You probably do use some of the built-in collections, such as Forms (the
collection of open forms.) If you need to open multiple instances of a form,
you might need your own collection to manage them. Demo:
Managing Multiple Instances of a Form
at: http://allenbrowne.com/ser-35.html
Here's another example where we use collections to manage recursive file
listing (i.e. including subfolders):
List files recursively
at: http://allenbrowne.com/ser-59.html
Another example of built-in collections: the controls attached to another
control. Most controls have only one control in their collection: the
attached label. For example, if you have a field called Text0, and you want
to change the color of its attached label:
Me.Text0.Contro ls(0).BackColor = vbRed
An option group can have more than one control in its collection, e.g.:
Function HowManyOptionBu ttons(grp As OptionGroup) As Integer
Dim ctl As Control
Dim i As Integer
For Each ctl In grp.Controls
If ctl.ControlType = acOptionButton Then
i = i + 1
End If
Next
HowManyOptionBu ttons = i
End Function
Other common collections include:
- controls on a form/report
- controls in a section of a form/report
- controls on a tab control
- reports
HTH.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"MLH" <CR**@NorthStat e.netwrote in message
news:dc******** *************** *********@4ax.c om...
You're right, Larry. I was just phishing for thoughts. I think Allen's
response the most helpful, indicating that a Collection is not useful
for manipulating or referring to a Recordset. I've never had a use
for Collections and was wondering if anyone used them in that way.
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx
On Sep 2, 10:26 pm, "Allen Browne" <AllenBro...@Se eSig.Invalidwro te:
Good to explore.
I used my first collection in 1994, iterating through it. I plan to
report to the group all about its usefulness, just as soon as the
procedure finishes.
"lyle" <ly************ @gmail.comwrote in message
news:11******** **************@ d55g2000hsg.goo glegroups.com.. .
On Sep 2, 10:26 pm, "Allen Browne" <AllenBro...@Se eSig.Invalidwro te:
>Good to explore.
I used my first collection in 1994, iterating through it. I plan to
report to the group all about its usefulness, just as soon as the
procedure finishes.
I think Lyle is doing my performance testing for me, and I very much look
forward to the result, should the test finish before the computer burns out.
:-)
Larry This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mmccaws |
last post by:
Thanks ahead for your help
I'm trying to learn what I can do with echo and print statements. I
figured out the echo statement and below is the simple version using
print. I've tried two dozen or more single print statements, first
start with the first part then adding additional phrases, then looking
at the page source code, but I'm missing something simple,(isn't that
always the way) What I'm trying to understand is how, if it's...
|
by: Rich Grise |
last post by:
I think I've finally found a tutorial that can get me started:
http://www.zib.de/Visual/people/mueller/Course/Tutorial/tutorial.html
and I've been lurking for awhile as well. What happened is, I've
been playing with Qt in KDE on a Slackware 10.0 system, and following
their cookbook exercises, and everything's working, and I have no
clue what the code is doing, i.e.. how do I connect my brain to the
ascii in the files to the stuff on...
|
by: Alex |
last post by:
I have searched the boards but I have not found what I am looking for
yet.
I have a form with two combo boxes. When the user makes a selection
in both of the combo boxes the information will look through two
tables and return the appropriate matches. This will be very small
scale at the beginning but once I get everything working it will
include more tables and dozens of matches to be returned.
I would like the information to print...
|
by: DC |
last post by:
Hi,
I need to asynchronously read from a network (TCP) stream, and I am
having trouble with retrieving whole blocks; I get a break in the data
block every 1460 bytes which relates to network packet sizes I guess.
To get this fixed, I am trying to follow an example in the MSDN, which
pretty much resembles what I want to do. Since the code (I can't do
this in a static class for example) is not 100% what I need, I
certainly would like to...
|
by: Dave |
last post by:
I used the following class and .aspx code below to understand how static
works on variables and methods taken from
"http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfstaticpg.asp".
I opened up two instances of my browser to simulate two users accessing the
page at the same time by pointing to Employee.aspx below. Refreshing several
times, the counter value is increased and shared between both browser...
| |
by: Henry |
last post by:
Hi. I've been trying to modify my dataset and have been unsucessful. Any
help would be great.
What I have is a dataset in a session variable. Here is what I have done to
stored into the dataset via store procedure.
Sample Stored Procedure:
CREATE PROCEDURE prcGetData
AS
|
by: RSH |
last post by:
Hi,
I have been reading on interfaces working on samples I've run across on the
web. For the life of me I cannot seem to grasp them.
It appears to me that interfaces are simply blueprints to a class, that when
implemented, they require the implementing calss to make sure that each of
the properties, functions etc. are handled by the class. (????)
What I am really having a problem with is how they overcome the limitation
|
by: jm |
last post by:
I am having trouble understanding the purposes of an interface, even
though the concept of interfaces is around me all the time (user
interface, for example). I'm just not understanding software
interfaces.
Like anything else, it appears Interfaces are by design something that
requires documentation. I know this may be obvious, but if I have a
class A and I say, well, class A implements IMyInterface. The fact
that it implements...
|
by: hmbscully |
last post by:
I am trying to send a complex mutli-part email with inline attachments
between html pieces.
I originally wrote the code in Perl with the MIME::Lite module, which
worked fine. My attempts to convert the code to PHP have ended in
frustration so far. It seems when I search, all roads point me to
PEAR's Mail_mimePart, but I am not understanding the example code
enough to try to use it.
Can someone help me start to figure out how this code...
|
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: 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: 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...
|
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 we have to send another system
|
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...
| |