+ Reply to Thread
Results 1 to 4 of 4

Member already exists in an object module form which this object module derives error

  1. #1
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    640

    Member already exists in an object module form which this object module derives error

    Within the attached document I have 2 Userforms (HR & SetUp). The HR code is run from the left button called "New Case".

    I am attempting to run the code in the HR form and when the Setup code is removed it works perfectly but once I loaded the SetUp code into the form I get the above error message.

    Google tells me that the error occurs because an object and a sub have the same name(within the SetUp form I assume) but this is all run from the CommandButton1_Click Private sub and I cannot locate anything out of place in the code or in the forms.

    Can anyone see what the error is referring to please as I was up to 4.30am this morning trying to fix this bug?
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Member already exists in an object module form which this object module derives error

    You have Varaibles with the same name as Objects on a form...

    Please Login or Register  to view this content.
    The variable Mort clashes with the Mort object (checkbox), CC also, and a couple of others...

  3. #3
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    640

    Re: Member already exists in an object module form which this object module derives error

    I have done this before and it has never been an issue. I thought because they are check boxes I had to declare the data type, if they were true or false,long, integer etc?
    Last edited by Sc0tt1e; 10-01-2014 at 02:47 AM.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: Member already exists in an object module form which this object module derives error

    No - you can't use the same name at module level (and you shouldn't at procedure level either). You've also got an issue here:
    Please Login or Register  to view this content.
    You should rename the routine ShowStartup.

    And another here (in the CommandButton1_click ):
    Please Login or Register  to view this content.
    because Today() is a worksheet function. In VBA you use Date().

    And here:
    Please Login or Register  to view this content.
    There is no control called Town - perhaps you meant City?

    There are more references to non-existent controls, as well as attempts to use Strings as objects.
    Everyone who confuses correlation and causation ends up dead.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Module vs Object
    By silver.sagi in forum Excel - New Users/Basics
    Replies: 10
    Last Post: 08-07-2020, 01:04 AM
  2. Setting module-level object variables
    By chrisanthny in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-26-2013, 08:16 PM
  3. [SOLVED] Declaring Object References at Module Level
    By RGrunden in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2012, 01:47 AM
  4. Replies: 3
    Last Post: 10-25-2011, 02:12 PM
  5. [SOLVED] To access a previous object via class module
    By Pierre Archambault in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-31-2005, 02:51 AM

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