B
ByB
Hello,
I am developping an app in VBA with Access. I work mainly with class
modules and OOP.
My problem is as follow :
- I created a class A. This class as a collection of 0 to 5 objects of
class B.
- I created the class B and it also has a collection of 0 to N objects
of class C.
- I created the class C.
So I have 1 object from class A, with 0 to 5 objects of class B in a
collection. Each object of class B has 0 to N objects iof class C in a
collection too.
The objects ou class C come from a database. So they have already an ID
I can use as the key when adding them to the collection of class B
objects.
But the objects of class B don't come from a database. I create them
myself in the app. So my concern is : what key should I use to identify
them and store them into (and retrieve them from) the collection in the
class A object ? Is it a good idea to use date and time of creation ?
So in fact, my main concern is how to create a unique ID from VBA code
to use the ID as a key when adding them into the collection, and how to
keep the ID (or recalculate it) when looking for retrieving the object
from the same collection ?
Thank you.
I am developping an app in VBA with Access. I work mainly with class
modules and OOP.
My problem is as follow :
- I created a class A. This class as a collection of 0 to 5 objects of
class B.
- I created the class B and it also has a collection of 0 to N objects
of class C.
- I created the class C.
So I have 1 object from class A, with 0 to 5 objects of class B in a
collection. Each object of class B has 0 to N objects iof class C in a
collection too.
The objects ou class C come from a database. So they have already an ID
I can use as the key when adding them to the collection of class B
objects.
But the objects of class B don't come from a database. I create them
myself in the app. So my concern is : what key should I use to identify
them and store them into (and retrieve them from) the collection in the
class A object ? Is it a good idea to use date and time of creation ?
So in fact, my main concern is how to create a unique ID from VBA code
to use the ID as a key when adding them into the collection, and how to
keep the ID (or recalculate it) when looking for retrieving the object
from the same collection ?
Thank you.