Results 1 to 2 of 2

Thread: Can anyone tell why this is a never-ending loop?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Posts
    78

    Angry

    Ok, I might be askin alot here. But I'm horrible at seeing my own mistakes...

    This loop never ends...

    Thanks alot if you can help.
    Do Until Text2.DataField = "FIELD128"
    strName1 = Mid(Text2.Text, 2)

    If InStr(1, LCase(strList), LCase(Mid(strName1, 2)),vbTextCompare) > 0 And strName1 <> "" Then

    strPort = Mid(strPort, 2)
    terrCount = terrCount + 1
    Call cmdPrintTerr_Click
    End If

    Text2.DataField = strField(dfInt + 1)
    Loop

    And the strField array is set up so that each substring is "FIELD" and the number.

    i.e. strField(1) = "FIELD1" and strField(120) = "FIELD120"


    Thanks again.

  2. #2
    New Member
    Join Date
    Feb 2001
    Posts
    7

    apply VB troubleshooting tools

    No errors raised? Here's what I can see as possibilities.

    Put parenthesis around IF conditions in loop - could be ambiguously evaluated.

    Could any variable (such as strName) by null? Will cause error or inconsistent results in InStr function, etc.

    What about Call cmd... - could this be the problem?

    Possible hidden control code in array contents?

    Is there an artificial limit (0-127) which never reaches 128?

    Hints: insert MsgBox to show variables inside your loop as it executes, see where it goes south. Insert breakpoints to pause and examine contents. Step through code to see where it dies.
    - huggy

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