473,394 Members | 1,932 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,394 software developers and data experts.

Syntax For Collection

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
Nov 13 '05 #1
5 1901
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)
Nov 13 '05 #2
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@privacy.com> wrote in message
news:oO*****************@newsread1.news.pas.earthl ink.net...
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)

Nov 13 '05 #3
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
Nov 13 '05 #4
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.*********@heuvelqop.nl> wrote in message
news:cq**********@news2.solcon.nl...
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

Nov 13 '05 #5
rkc
Scott wrote:
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


Nov 13 '05 #6

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

Similar topics

22
by: Tuang | last post by:
I'm checking out Python as a candidate for replacing Perl as my "Swiss Army knife" tool. The longer I can remember the syntax for performing a task, the more likely I am to use it on the spot if...
75
by: David MacQuigg | last post by:
Seems like we need a simple way to extend Python syntax that doesn't break existing syntax or clash with any other syntax in Python, is easy to type, easy to read, and is clearly distinct from the...
4
by: Niall | last post by:
Ok, maybe this is getting too lazy and too demanding, but hey, I thought I'd see what people thought about it. Would anyone else find a syntax like: foreach (string Name in CompanyNames and...
23
by: Marcin Grzębski | last post by:
I red MSDN article of C# 2.0 this week... and i found very strange syntax for properties e.g.: public int MyIntValue { get { // ... } protected set { // ... }
11
by: Davíđ Ţórisson | last post by:
hi I'm new to c# and although having read 2 tutorials I cannot find what the parenthesis in these 2 example situations mean; 1) string strKeyValue = (string)sampleConfig; 2) class myParentPage...
2
by: bor_kev | last post by:
Hi, First of all, i want to use the new managed class syntax and STL.NET under Microsoft Visual (C++) Studio 2005 Beta. I read in a Microsoft...
2
by: Pete Mitchell | last post by:
I have a class called "Action" that has a Public member variable called colLinks that is a collection of other classes called "Links". (Actions contain Links) The problem I'm having is looping...
13
by: usenet | last post by:
How and where can one find out about the basics of VB/Access2003 syntax? I am a died in the wool C/C++/Java Linux/Unix programmer and I am finding it difficult to understand the program format...
2
by: =?Utf-8?B?a2VubmV0aEBub3NwYW0ubm9zcGFt?= | last post by:
When creating multiple iterators, the original is defined as returning IEnumerator, ie public IEnumerator GetEnumerator() { yield x; ...} whereas the additional ones are defined as returning...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.