By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,444 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

Custom Collection

P: n/a
Is there any way to display elements in a custom collection in a form? Can
elements me added and deleted through a form?

Thanks!

Mark
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Consider using a table instead of a collection and what you want to do is
simple. If you use a collection, it is more complicated -- unbound forms or
temporary tables and such.

Larry Linson
Microsoft Access MVP

"Mark" <mm*****@earthlink.net> wrote in message
news:K9****************@newsread1.news.atl.earthli nk.net...
Is there any way to display elements in a custom collection in a form? Can
elements me added and deleted through a form?

Thanks!

Mark

Nov 12 '05 #2

P: n/a
How you reference them depends on what kinds of objects are in the
collection, but assuming the objects in your collection have a Name
property, you could loop through them with:
Dim obj As Object
For Each obj In MyCollection
Debug.Print obj.Name
Next

To display them in a form, you could output a string to a tall text box, or
use AddItem with a listbox.

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

"Mark" <mm*****@earthlink.net> wrote in message
news:K9****************@newsread1.news.atl.earthli nk.net...
Is there any way to display elements in a custom collection in a form? Can
elements me added and deleted through a form?

Nov 12 '05 #3

P: n/a
The only really reliable ways to do this are to temporarily store the data in
a table for editing or to use the ListView activeX control (some code
required). In the case of the ListView control, you'll still have to copy the
data from your Colleciton object into the List's Items collection and back,
but you won't have to copy the data into persistent storage.

Using a table is probably the most flexible approach, but it does have down
sides. You'll have to partition the data in the table if it's possible to
open more than one instance of the database front end, and if the application
terminates abnormally, you'll have garbage records left in the table.

On Sat, 03 Jan 2004 23:23:22 GMT, "Mark" <mm*****@earthlink.net> wrote:
Is there any way to display elements in a custom collection in a form? Can
elements me added and deleted through a form?

Thanks!

Mark


Nov 12 '05 #4

P: n/a
On Sat, 03 Jan 2004 23:23:22 GMT, "Mark" <mm*****@earthlink.net>
wrote:

Wrox had a book, something like "Business objects with VB" that
described a way to do this. It seemed very cumbersome to me. I would
first have to be convinced your custom object and collection is better
than a table.

-Tom.

Is there any way to display elements in a custom collection in a form? Can
elements me added and deleted through a form?

Thanks!

Mark


Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.