dbTalk Databases Forums  

Custom Object built on the fly?

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


Discuss Custom Object built on the fly? in the comp.databases.ms-access forum.



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

Default Custom Object built on the fly? - 03-19-2010 , 04:29 AM






Hi Everyone,

I am wanting to know if it is possible to build a custom object /
class 'on the fly'. I am hoping to create a class that has elements
for each field in a recordset - wihtout knowing the fields before
retreiving the recordset. I would then use a collection of these
objects to 'pool' the data. The reason behind this is that I am
pulling data from multiple sources, and not all of them are known
beforehand.

At the moment I am using arrays to do the job of holding the data (in
a collection), and a separate collection of arrays that holds the
recordsets' definitions (name, type, definedsize). I would prefer to
do this with 'objects' but I am guessing I can only do this if I know
the definitions beforehand.

Any thoughts are appreciated.

Cheers

The Frog

Reply With Quote
  #2  
Old   
Tom van Stiphout
 
Posts: n/a

Default Re: Custom Object built on the fly? - 03-19-2010 , 07:35 AM






On Fri, 19 Mar 2010 03:29:22 -0700 (PDT), The Frog
<mr.frog.to.you (AT) googlemail (DOT) com> wrote:

This has already been built for you: a DAO.Recordset object has a
Fields collection. Would that do it?

-Tom.
Microsoft Access MVP


Quote:
Hi Everyone,

I am wanting to know if it is possible to build a custom object /
class 'on the fly'. I am hoping to create a class that has elements
for each field in a recordset - wihtout knowing the fields before
retreiving the recordset. I would then use a collection of these
objects to 'pool' the data. The reason behind this is that I am
pulling data from multiple sources, and not all of them are known
beforehand.

At the moment I am using arrays to do the job of holding the data (in
a collection), and a separate collection of arrays that holds the
recordsets' definitions (name, type, definedsize). I would prefer to
do this with 'objects' but I am guessing I can only do this if I know
the definitions beforehand.

Any thoughts are appreciated.

Cheers

The Frog

Reply With Quote
  #3  
Old   
The Frog
 
Posts: n/a

Default Re: Custom Object built on the fly? - 03-22-2010 , 02:24 AM



Hi Tom,

Not really. I was thinking more of working with stacks and ques. I am
not aware of any way to achive this except with classes (for complex
objects). I am thinking that it might be easier to build a simple
object heirarchy, effectively simulating the recordset object - but
without all the database specific functions. Just a data holder in
effect. Its for a set of rather complex analyses where the recordset
itself isnt suitable. I need to be able to manipulate each object
individually and feed them into different parts of the analysis
independantly.

Cheers

The Frog

Reply With Quote
  #4  
Old   
Tom van Stiphout
 
Posts: n/a

Default Re: Custom Object built on the fly? - 03-22-2010 , 07:55 AM



On Mon, 22 Mar 2010 01:24:52 -0700 (PDT), The Frog
<mr.frog.to.you (AT) googlemail (DOT) com> wrote:

OK, I re-read your OP and did get a different impression. Sure you can
build your own objects, and put them in collections. If you think
about the Properties collection for example it is built on-the-fly and
you can add new elements to it at any time.

-Tom.
Microsoft Access MVP


Quote:
Hi Tom,

Not really. I was thinking more of working with stacks and ques. I am
not aware of any way to achive this except with classes (for complex
objects). I am thinking that it might be easier to build a simple
object heirarchy, effectively simulating the recordset object - but
without all the database specific functions. Just a data holder in
effect. Its for a set of rather complex analyses where the recordset
itself isnt suitable. I need to be able to manipulate each object
individually and feed them into different parts of the analysis
independantly.

Cheers

The Frog

Reply With Quote
  #5  
Old   
The Frog
 
Posts: n/a

Default Re: Custom Object built on the fly? - 03-23-2010 , 04:01 AM



Hi Tom,

Thats a great example. I didnt think of that. Its perfect. Create a
basic 'atom' of information as an object, and create a 'molecule'
object that has a collection of 'atoms'. That will do nicely :-)

Thanks for kicking this around with me Tom, I appreciate it.

Cheers

The Frog

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.