+ Reply to Thread
Results 1 to 4 of 4

Weird Error!! Can someone help please

Hybrid View

cgi_pro Weird Error!! Can someone... 11-22-2006, 06:02 AM
Carim Hi, My assumption is... 11-22-2006, 06:09 AM
cgi_pro It is public already!! This... 11-22-2006, 08:11 AM
Bryan Hessey Hi, That it works in one... 11-22-2006, 08:42 AM
  1. #1
    Registered User
    Join Date
    02-12-2006
    Posts
    54

    Weird Error!! Can someone help please

    Hello

    I have this following function in a module called (MyFunctions):

    Sub AddPlayer(GivenPlayerName As String, GivenPrefixContactNumber As String, GivenContactNumber As String, GivenCompanyName As String)
    
        UnProtectSheet PlayersList
        
        Players_List_SetNextEntry
        PlayersList.Cells(Players_List_NextEntry, Players_List_No_Column).Value = Players_List_NextEntry - (Players_List_FirstEntry - 1)
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerName_Column).Value = GivenPlayerName
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerContact_Column).Value = "(" + GivenPrefixContactNumber + ") " + GivenContactNumber
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerCompany_Column).Value = GivenCompanyName
        
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerGroup_Column).Locked = False
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerGroup_Column).Validation.Delete
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerGroup_Column).Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=GetGroups
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerGroup_Column).Validation.IgnoreBlank = True
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerGroup_Column).Validation.InCellDropdown = True
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerGroup_Column).Validation.InputTitle = ""
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerGroup_Column).Validation.ErrorTitle = "Error Inputting"
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerGroup_Column).Validation.InputMessage = ""
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerGroup_Column).Validation.ErrorMessage = "Only groups that are available from the drop list are allowed in this field"
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerGroup_Column).Validation.ShowInput = True
        PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerGroup_Column).Validation.ShowError = True
        
        ProtectSheet PlayersList
        
    End Sub
    So, When I call this function (AddPlayer) from within the subroutine Workbook_Open() then it works just fine, however when I call it from MyFormButton_OnClick() subroutine then it gives me the error message that you can find attached in this post as an image format. So, when I hit the debug button it hightlights and takes me to the following line of this (AddPlayer) function:

    PlayersList.Cells(Players_List_NextEntry, Players_List_PlayerGroup_Column).Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=GetGroups
    I don't get it, what's wrong here?

    Note: The (GetGroups) in that line of code above is a function that gets the available groups names that are to be selected from for each player name.
    Attached Images Attached Images

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    My assumption is similar to yours ...
    It must be related to the function GetGroups ...

    Difficult to guess ..., may be

    make it Public, if it is Private ...

    HTH
    Carim

  3. #3
    Registered User
    Join Date
    02-12-2006
    Posts
    54
    It is public already!! This is really weird, I just don't know why the object disconnects from the caller at that line

  4. #4
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by cgi_pro
    It is public already!! This is really weird, I just don't know why the object disconnects from the caller at that line
    Hi,

    That it works in one area (Workbook Open) but not later from Forms, and given that Validate List is a 'single-sheet' function I would check the 'Active Sheet' at both times, but I will agree that the error doesn't really point to an error of this nature (but then - since when did VB errors seem logical)

    hth
    ---
    Si fractum non sit, noli id reficere.

+ 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