+ Reply to Thread
Results 1 to 9 of 9

Dealing with Stack Over Flow Errors

  1. #1
    Registered User
    Join Date
    05-15-2019
    Location
    NANYUKI, KENYA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    4

    Dealing with Stack Over Flow Errors

    Hello guys

    Am not an expert in programming but recently took up the challenge to create my own Stock Management System using VBA coding and a number of linked excel sheets receiving stock entry and sales data.Having a headache with the following coding below which is giving me a stack overflow error. I do have a form and once I scan an item's barcode into the Combobox3 the rest of the text boxes should be populated with the associated details in terms of the item code (textbox 2) Item Name(textbox3) Category(textbox4) etc. Stack overflow error 6 appears from Line no8. Will appreciate any assistance or suggestions that can help me get around this.


    Private Sub ComboBox3_Change()

    Me.ComboBox3.List = Worksheets("STOCK ITEM ENTRY REGISTER").Range("b2:b500").Value

    If Me.ComboBox3.Value <> "" Then
    Dim Sh As Worksheet
    Set Sh = ThisWorkbook.Sheets("STOCK ITEM ENTRY REGISTER")
    Dim i As Long
    Sh.Unprotect "CARLOS2018"

    i = Application.Match(VBA.CLng(Me.ComboBox3.Value), Sh.Range("B:B"), 0)
    Me.TextBox2.Value = Sh.Range("C" & i).Value
    Me.TextBox3.Value = Sh.Range("E" & i).Value
    Me.TextBox7.Value = Sh.Range("F" & i).Value
    Me.TextBox4.Value = Sh.Range("G" & i).Value
    Me.TextBox8.Value = Sh.Range("H" & i).Value
    Me.TextBox5.Value = Sh.Range("I" & i).Value
    Me.TextBox6.Value = Sh.Range("J" & i).Value
    Sh.Protect "CARLOS2018"
    End If


    End Sub

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,276

    Re: Dealing with Stack Over Flow Errors

    Why are you changing the combobox's list from its change event?
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,302

    Re: Dealing with Stack Over Flow Errors

    Hi CARLOSDEJACKAL

    Welcome to our Forum...

    Please take a moment to read our forum rules...here
    Your post does not comply with Rule # 2
    2. Programming code must be enclosed in code tags to improve readability. (A, Z)
    Please Login or Register  to view this content.
    So...Edit your post...Highlight the code and press the # button
    This post should receive no further attention until OP has complied...
    Last edited by sintek; 05-15-2019 at 10:59 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  4. #4
    Registered User
    Join Date
    05-15-2019
    Location
    NANYUKI, KENYA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    4

    Re: Dealing with Stack Over Flow Errors

    Hello guys

    Am not an expert in programming but recently took up the challenge to create my own Stock Management System using VBA coding and a number of linked excel sheets receiving stock entry and sales data.Having a headache with the following coding below which is giving me a stack overflow error. I do have a form and once I scan an item's barcode into the Combobox3 the rest of the text boxes should be populated with the associated details in terms of the item code (textbox 2) Item Name(textbox3) Category(textbox4) etc. Stack overflow error 6 appears from Line no8. Will appreciate any assistance or suggestions that can help me get around this.


    Please Login or Register  to view this content.

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,276

    Re: Dealing with Stack Over Flow Errors

    My original question stands.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: Dealing with Stack Over Flow Errors

    Also, if U use Application.Match your variable needs to be declared as Variant since it must be able to either hold an errorcode or a number.

    So declare i as variant, not as Long.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  7. #7
    Registered User
    Join Date
    05-15-2019
    Location
    NANYUKI, KENYA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    4

    Re: Dealing with Stack Over Flow Errors

    Hello Rorya

    The reason why am using the change event is because combobox3 will experience changes in terms of me selecting different existing bar code figures from the scroll list so as to populate the text boxes

  8. #8
    Registered User
    Join Date
    05-15-2019
    Location
    NANYUKI, KENYA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    4

    Re: Dealing with Stack Over Flow Errors

    Hello Bakerman

    Do appreciate your prompt response. I've tried declaring i as Variant. Stack overflow error 6 still popping up

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: Dealing with Stack Over Flow Errors

    Why are you refreshing the entire list prior to looking up a certain value.

    My best guess is that it's a compilation of Change-events filling up the stack.

    Set the list at the Initialze event of the userform, not in a Change event.

    If you do need to update the list after performing the search make sure you disable the triggering of the Change-event.
    Last edited by bakerman2; 05-16-2019 at 07:49 AM. Reason: Typo

+ 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. Web query - dealing with time-out errors
    By supern0va in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-19-2018, 08:04 AM
  2. Dealing with Rounding Errors
    By stockgoblin42 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-29-2013, 01:23 AM
  3. [SOLVED] dealing with errors in macros
    By wellsw in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-06-2013, 03:11 PM
  4. dealing with errors in an array
    By weeble33 in forum Excel General
    Replies: 4
    Last Post: 08-23-2012, 02:49 PM
  5. Dealing with errors in file save macro
    By tcombest in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-20-2012, 02:43 PM
  6. Dealing with errors
    By [email protected] in forum Excel General
    Replies: 6
    Last Post: 03-27-2006, 08:35 AM
  7. SUMPRODUCT errors dealing with dates
    By BeeFreedman in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-21-2005, 01:08 PM

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