Results 1 to 7 of 7

Thread: Loop within a Do While

  1. #1

    Thread Starter
    Lively Member Patrice Bourdages's Avatar
    Join Date
    Jun 2000
    Location
    Quebec, Canada
    Posts
    83

    Angry

    Here's the bummer:

    Private Sub TraitementComplet()
    OuvreTables
    AcXref.MoveFirst
    Do While Not AcXref.EOF
    If Not LigneUtile(AcXref!Col001) Then
    AcXref.MoveNext
    Loop
    End If
    If InStr("File:", AcXref!Col001) > 0 Then
    mNomDeTable = Trim(Mid(AcXref!Col001, 28, 10))
    lblTable.Caption = mNomDeTable
    If mTable <> mNomDeTable Then
    mCompteur = 0
    mTable = mNomDeTable
    End If
    AcXref.MoveNext
    Loop
    End If
    ExtraitInfoLigne
    Stats
    Dictionnaire
    XRef
    AcXref.MoveNext
    Loop
    End Sub

    I'm trying to loop within the Do While and the programs bombs out with an error saying that there is a missing do for my loop statement...

    I'm sure this is a wrong way of doing it! What is the right way. I'm trying to go back to the beginning of the do while AcXref statement to continue processing...

    Thanks in advance for your "always helpfull" help.

    Sincerely, Patrice

  2. #2

    Thread Starter
    Lively Member Patrice Bourdages's Avatar
    Join Date
    Jun 2000
    Location
    Quebec, Canada
    Posts
    83

    Unhappy

    Why is it that my code was perfectly indented and now showing up all left justified !!! What a messy day...

    Sorry for the spaghetti code... :-/

  3. #3
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    God what a mess. Hard to tell what you wanted, but this may be it.

    You seemed to be using the keyword "Loop" far to many times. You can only have one "Loop" for Each "Do".

    Code:
    Private Sub TraitementComplet()
    
        OuvreTables
        AcXref.MoveFirst
        
        Do While Not AcXref.EOF
          If Not LigneUtile(AcXref!Col001) Then
            AcXref.MoveNext
          
          ElseIf InStr("File:", AcXref!Col001) > 0 Then
            mNomDeTable = Trim(Mid(AcXref!Col001, 28, 10))
            lblTable.Caption = mNomDeTable
            
            If mTable <> mNomDeTable Then
              mCompteur = 0
              mTable = mNomDeTable
            End If
            
            AcXref.MoveNext
          Else
            ExtraitInfoLigne
            Stats
            Dictionnaire
            XRef
            AcXref.MoveNext
          End If
        Loop
        
    End Sub

    [Edited by Iain17 on 06-27-2000 at 09:46 AM]
    Iain, thats with an i by the way!

  4. #4

    Thread Starter
    Lively Member Patrice Bourdages's Avatar
    Join Date
    Jun 2000
    Location
    Quebec, Canada
    Posts
    83

    Smile

    Will try this right away...

    I'll keep you posted...

    Thanks.

    Patrice

  5. #5

    Thread Starter
    Lively Member Patrice Bourdages's Avatar
    Join Date
    Jun 2000
    Location
    Quebec, Canada
    Posts
    83

    Red face

    I don't understand...

    I posted a reply a long time ago for this one... Must have got lost somewhere...

    It worked wonderfully. It was just a question of understanding the structure of a DO WHILE a little better.

    Thank you very much for your help Iain17.

    Your help was greatly appreciated...

    Sorry for the delay... :-/

    Sincerely yours,

    Patrice B.
    Information System Analyst
    SAS 9.1.3, VB6 SP6, VB.Net 2003, SQL7.0/2000

  6. #6
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Better late than never huh

    As always the pleasure was all mine
    Iain, thats with an i by the way!

  7. #7
    Addicted Member
    Join Date
    Aug 2000
    Location
    Columbus Ohio
    Posts
    217

    Angry Of Course Iain

    I come to help(I really saw the prob before I scrolled down) but of course YOU(what are the odds) answered first. Lol
    Chris

    [email protected]
    Windows XP RC2 B2526
    Visual Studio.Net Beta 2
    C++, VB, VB.Net, ASP, PHP

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