+ Reply to Thread
Results 1 to 4 of 4

Compile error: Variable not defined

  1. #1
    Registered User
    Join Date
    01-02-2007
    Posts
    8

    Question Compile error: Variable not defined

    I'm close to the end of this code, but there is a problem with it.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    and i get :
    Compile error:
    Variable not defined
    on 'Set zx = SumXCollection(artikal)' in Sub2().

    What is particularly odd is that the code shouldn't enter the first part of the If statement immediately, because in the first pass the item (from the condition) doesn't exist, so the code must drop to Else part of the If statement, where a zx object needs to be created.

    So that, every new zx object is created in the second (Else) part of the If st., and every existing one is updated in the first part.

    What's wrong with this?

    Thanks a lot in advance
    Last edited by radion; 01-23-2007 at 08:07 PM.

  2. #2
    Forum Contributor
    Join Date
    12-12-2005
    Posts
    667
    I haven't check all your code, but:
    artikal = Product.Text
    Product doesn't seem to be a recognized onject!!
    Best regards,

    Ray

  3. #3
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    I am very new to VBA, so I'm not positive on this, but doesn't it look for undeclared variables before processing the code? Also, I don't see where you declared zx. Are you using Option Explicit?

  4. #4
    Registered User
    Join Date
    01-02-2007
    Posts
    8

    Thumbs up

    There was 2 mistakes:

    1) (yes) Public zx As SumX missed (btw-is that definition or declaration?)

    2) TotalXX instead of pTotalXX in Public Property Let TotalXX function (Class module) - this mistake produces: Run-time error '28':Out of stack space

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1