?
Solved

Accessing a Collection within a Class

Posted on 2001-08-16
4
Medium Priority
?
177 Views
Last Modified: 2010-05-02
I have created two classes, one called Order and the other called LineItem. The Order class has a Collection in it of type LineItem. I am writing a method in my Order class to populate the Order object and the lineitem collection based on the order info in a database. However, I do not know how to access the lineitems from within this method. I have tried using the lineitem.add but I get an error. It would seem pointless to do a seperate Lineitem method to populate that, but it seems to be the only option unless I can figure out how to do it within the method of my Order object/class.

Any help would be appreciated!

Thanks.
0
Comment
Question by:kriskramer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 400 total points
ID: 6394348
declare the method as public
0
 
LVL 2

Expert Comment

by:BozzoCage
ID: 6394803
If I properly undersood:

class LineItem
  private p_linedata as string
  public sub SetData(l as string)
     p_linedata = l
  end sub

class Orders
  private p_item as Collection
  public sub class_initialize
    set p_item=new Collection
  end sub
  public sub Populate
    dim l as new LineItem
    l.SetData (rst("name"))
    p_item.Add l
  end sub
  public function GetLineData(lineNo as long)
    GetLineData = p_item(lineNo)
  end function
 
------

Read code and ask if something is unclear.

Regards,
  BozzoCage  
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7202339
Hi kriskramer,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept bobbit31's comment(s) as an answer.

kriskramer, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7215951
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question