Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event

  • Hi Ozgrid Experts,


    I'm new to VBA Excel and I'm currently working on this little stats calculator but I'm stuck on my Tabstrip Change Event. I'm getting an error when I'm trying to read value from a table.
    First load is ok. When I open the form it will show no data on the first tab then if I change to any tab then go back to first tab it will load the values without a problem, but after I change to another tab and go back again to the first tab, it will throw a Could Not Set The Value Property error.


    Just to give you an idea of what I want to do. The user will enter data from various controls and it'll save those data a table in my 'Calc' sheet then the macro will pull those data again when the tab is active again. Hopefully I making any sense. It's basically a little database that will be use to record the user input. Thanks!


  • Re: Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event


    Hi
    the combobox clear cause the error in this sub

  • Re: Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event


    Wow. I never thought that it would affect the tabstrip. My problem now is the ComboBox keeps adding new data in the list.


    EDIT: After several tries, again it throws out the same error even after commenting out the .Clear


    :(

  • Re: Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event


    Hi Pike,


    Yes, there's a loop inside a combobox event because the combobox value is dependent to another combobox. Thus, the .Clear. But yeah, even after commenting it out it still throws the same error.

  • Re: Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event


    Ok for get the last post
    tested and this works


    the loop in the comboboxes is the order they are filled and cascade to the next combobox

  • Re: Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event


    The ComboBox cbxItem does not have any items so throws the error... Did you forget to re-populate that?

  • Re: Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event


    I used the Tabstrip because I'm using the same controls for 8 items. I'm reading between data through the Tabstrip Index.


    EDIT: I'll take a look into that. Thanks for all the replies.

  • Re: Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event


    Hi Pike,


    I just tested it and it seems to work fine if at initialize the default tab is the first tab. But if I left it and save it with a different active tab, the next time I open it, it throws the same error again.


    @Grimes,


    It should be getting the value from the Tabstrip Change event. So, I'm not really sure why I'm getting the error.

  • Re: Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event


    Well, it is empty and you know the program flow better than me - I'll leave it to you to figure why.

  • Re: Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event


    in the initialise code when you pick a different tab you pick a different combobox range and list which doesn't match the list form where first value originates
    you mixing the array values
    the comboxbox will error if the value is not in the atrray list

    Code
    If i = 0 Then
            Set itmLvl = ThisWorkbook.Names("wpLvl").RefersToRange
            Set itm = ThisWorkbook.Names("wp").RefersToRange
        Else
            Set itmLvl = ThisWorkbook.Names("suit").RefersToRange
            Set itm = ThisWorkbook.Names("suitLvl").RefersToRange
        End If
  • Re: Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event


    I was scanning the code carefully and I notice that mixed up the 2 range.


    Code
    If i = 0 Then
            Set itmLvl = ThisWorkbook.Names("wpLvl").RefersToRange
            Set itm = ThisWorkbook.Names("wp").RefersToRange
        Else
            Set itm = ThisWorkbook.Names("suit").RefersToRange
            Set itmLvl = ThisWorkbook.Names("suitLvl").RefersToRange
        End If


    Hopefully, this will solve it all. Thank you for all the help Pike and Grime.

  • Re: Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event


    hi
    unfortunately No as you are still using different namedranges
    the values are dependant on the namedrange and once you initialise you set the namedrange and it can be a miss match with the data and will error

  • Re: Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event


    Yeah, still the same. There's a conflict with the values when reading through the 'Calc' table.



    [ATTACH=CONFIG]68812[/ATTACH]
    arrData(c, 3)'s value is from different set of item. It's not getting updated properly.

  • Re: Could Not Set The Value Property. Invalid Property Value. Tabstrip Change Event


    Quote from pike;768922

    looking like it has solved the error
    well done


    arrrr what is if for?


    that if is to determine which Tab is active. if it's 0 then the DropDown will use the tbl_weapon, if not then it will use the tbl_suit.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!