dbTalk Databases Forums  

Syntax For Collection

comp.databases.ms-access comp.databases.ms-access


Discuss Syntax For Collection in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Scott
 
Posts: n/a

Default Syntax For Collection - 12-17-2004 , 09:34 PM






I have a custom collection named CourseDates. In a procedure after I Dim Col
As Collection, what is the syntax to set Col = to CourseDates?

Thanks!

Scott



Reply With Quote
  #2  
Old   
MGFoster
 
Posts: n/a

Default Re: Syntax For Collection - 12-17-2004 , 10:59 PM






Scott wrote:
Quote:
I have a custom collection named CourseDates. In a procedure after I Dim Col
As Collection, what is the syntax to set Col = to CourseDates?
Usually goes something like this:

' declare the type and instantiate it at the same time
dim colCourseDates as new Collection

OR

' declare the type
dim colCourseDates as Collection

' instantiante the collection
set colCourseDates = new Collection

' Add an item to the collection
colCourseDates.Add <key>, <value>

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)


Reply With Quote
  #3  
Old   
Scott
 
Posts: n/a

Default Re: Syntax For Collection - 12-18-2004 , 09:56 AM



Thank you for responding!

The collection CourseDates already exists; I don't want to create a new
collection. I want to set Col = to CourseDates. So I have:
Dim Col As Collection
<What goes here?>

It would be the same as setting Col to the Forms collection.

Thanks,

Scott


"MGFoster" <me (AT) privacy (DOT) com> wrote

Quote:
Scott wrote:
I have a custom collection named CourseDates. In a procedure after I Dim
Col
As Collection, what is the syntax to set Col = to CourseDates?

Usually goes something like this:

' declare the type and instantiate it at the same time
dim colCourseDates as new Collection

OR

' declare the type
dim colCourseDates as Collection

' instantiante the collection
set colCourseDates = new Collection

' Add an item to the collection
colCourseDates.Add <key>, <value

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)



Reply With Quote
  #4  
Old   
Bas Cost Budde
 
Posts: n/a

Default Re: Syntax For Collection - 12-18-2004 , 10:38 AM



Scott wrote:
Quote:
I have a custom collection named CourseDates. In a procedure after I Dim Col
As Collection, what is the syntax to set Col = to CourseDates?

Thanks!
Set Col = CourseDates

This doesn't create a new collection, it merely lets (the pointer) Col
point to (the same location as) CourseDates. Changes in the one are
changes in the other;

so why do you want this?

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea


Reply With Quote
  #5  
Old   
Scott
 
Posts: n/a

Default Re: Syntax For Collection - 12-18-2004 , 12:19 PM



I'm just learning about collections and am not sure of their life. I create
the CourseDates collection in one form using the New method. I then need to
refer to the CourseDates collection in another form and I am thinking that I
have to Dim and Set a variable to be able to refer to the collection. I
don't know enough yet to know if CourseDates even exists any more after I
close the form that created it. Thanks for any enlightenment you can
provide.

Scott


"Bas Cost Budde" <b.costbudde (AT) heuvelqop (DOT) nl> wrote

Quote:
Scott wrote:
I have a custom collection named CourseDates. In a procedure after I Dim
Col
As Collection, what is the syntax to set Col = to CourseDates?

Thanks!

Set Col = CourseDates

This doesn't create a new collection, it merely lets (the pointer) Col
point to (the same location as) CourseDates. Changes in the one are
changes in the other;

so why do you want this?

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea



Reply With Quote
  #6  
Old   
rkc
 
Posts: n/a

Default Re: Syntax For Collection - 12-18-2004 , 01:44 PM



Scott wrote:
Quote:
I'm just learning about collections and am not sure of their life. I create
the CourseDates collection in one form using the New method. I then need to
refer to the CourseDates collection in another form and I am thinking that I
have to Dim and Set a variable to be able to refer to the collection. I
don't know enough yet to know if CourseDates even exists any more after I
close the form that created it. Thanks for any enlightenment you can
provide.

If the collection variable is dimmed and set in the first form it
will be destroyed when the form is closed. You can however dim a
public collection variable in the second form and set it equal to
the collection variable in the first form before the first form is
closed.

DoCmd.OpenForm "Form2"
Set Forms("Form2").colInFrm2 = colInFrm1
Docmd.Close acForm, Me.Name






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.