Results 1 to 4 of 4

Thread: Out of stack space

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2004
    Posts
    100

    Out of stack space

    My program goes like this:
    1) I have date range 6th to 16th
    2) If current date equals to date range stated above, the Command1 button will be automatically clicked.

    But, the problem is I got this error when running this program.

    Runtime error '28':
    out of stack space

    Why this error occur ? Can someone help me correct this error?

    Below is the code:
    VB Code:
    1. Private Sub lbltime_Change()
    2. dateCreate_1 = Month(Now) & "/6/" & Year(Now)
    3. dateCreate_2 = Month(Now) & "/16/" & Year(Now)
    4. lbltime.Caption = Date
    5. Dim bil As Date
    6. For bil = dateCreate_1 To dateCreate_2
    7. tarikhCreate = bil
    8. Label1.Caption = tarikhCreate
    9.      If lbltime.Caption = Label1.Caption Then
    10.         Command1_Click
    11.      End If
    12. Next
    13. End Sub

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Out of stack space

    doing lbltime.Caption = whatever calls the Change event.

    if you do this within the change event then you're going to get recursive calling of your code - which can end up in Out of Stack Space errors when the calls get too 'deep'

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2004
    Posts
    100

    Re: Out of stack space

    Actually, I didnt really understand ur post.
    Can you suggest solution for this problem?

  4. #4
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: Out of stack space

    put a break point and then step through your code using F8

    you'll probably find that it starts calling itself recursively - getting stuck and causing the error.

    they can be hard to pin down without running code - it might be Command1_Click or lbltime.Caption = Date or combination of both, or something else.

Posting Permissions

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



Click Here to Expand Forum to Full Width