Advertisement

03.20.2008 at 01:36PM PDT, ID: 23258364
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.8

Module-Level Collection Object (Scope Issues)

Asked by mwolfe02 in VB Objects, Visual Basic Programming, Microsoft Excel Spreadsheet Software

Tags: ,

I am having some issues with an ActiveX DLL I've written in Visual Basic 6.  The DLL is being used as an automation add-in in Excel XP to provide worksheet functions that query an Access XP mdb.  

I am maintaining a collection of snapshot recordsets in a module-level collection in a class module named "clsSumRecs".  The worksheet functions are maintained in a different class module named "root".  

Here's an overview of the two class modules:

root
-----
Private csr As New clsSumRecs

Public Function Balance(Account As String, BalDate As Date) As Variant
    Balance = csr.GetBal(Account, BalDate)
End Function

Public Sub ResetData()
    csr.RequeryColls
End Sub


clsSumRecs
--------------
Private BalanceColl As Collection

Public Function GetBal(AcctNum As String, BalDate As Date) As Variant
    '1. Finds the recordset it needs by BalDate from the BalanceColl collection
    '2. Creates a new recordset and adds it to the BalanceColl collection if it can't find an existing recordset for BalDate
    '3. Returns the balance of AcctNum
End Function

Public Sub RequeryColls()
    '1. Checks to see if the BalanceColl collection exists
    '2. If BalanceColl exists, then it loops through the collection requerying each recordset
End Sub


The problem is that when I call RequeryColls from the ResetData in the root module, the collection object is empty.  However, if I call RequeryColls from the GetBal function in the clsSumRecs module, the collection is not empty and the recordsets get requeried as they should.  Why???

It is almost as if the GetBal function is passing the BalanceColl collection to the RequeryColls procedure, even though BalanceColl is a module-level variable common to both procedures.  Any ideas?

-mikeStart Free Trial
[+][-]03.20.2008 at 02:57PM PDT, ID: 21176261

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.20.2008 at 03:59PM PDT, ID: 21176713

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.20.2008 at 03:59PM PDT, ID: 21176716

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.20.2008 at 04:34PM PDT, ID: 21176890

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: VB Objects, Visual Basic Programming, Microsoft Excel Spreadsheet Software
Tags: VB, Visual Basic 6.0
Sign Up Now!
Solution Provided By: PaulHews
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.20.2008 at 04:35PM PDT, ID: 21176899

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.20.2008 at 05:07PM PDT, ID: 21177065

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.21.2008 at 05:44AM PDT, ID: 21179482

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628