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.Controls(0).BackColor = vbRed
An option group can have more than one control in its collection, e.g.:
Function HowManyOptionButtons(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
HowManyOptionButtons = 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**@NorthState.netwrote in message
news:dc********************************@4ax.com...
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.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx