Results 1 to 3 of 3

Thread: what's wrong with this code?

  1. #1

    Thread Starter
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471
    Can someone plz tell me what is the problem with this code?
    What it's doing is taking each value in a particular
    database field and parsing a text file for it line by line.
    If it finds it, it executes some code and continues searching the text file. When it gets to the end of the text file, it should move to the next record in the
    database. But what is happening is it's jumping from the
    for strValue = recordset!field line right to the next j

    rsCount is already determind prior to this and it's the
    count of the records in the recordset (it is a valid number
    by the way)

    Code:
    For i = 1 To RecordsetsThatImRunningThrough
        recordset.MoveFirst
        Open File.txt for append as #1
    For j = 1 To rsCount
            strValue1 = recordset!Field
            Do While Not EOF(1)
                'My Code Here
            Loop
            recordset.MoveNext
    Next j
    Close #1
    Next i
    Thanks for the help

    Bababooey
    Tatatoothy
    Mamamonkey

  2. #2

    Thread Starter
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471

    mistake

    the 'for i' loop is a loop of a couple of different recordsets
    while the 'for j' loops through the individual recorset

    sorry for the confusion
    Bababooey
    Tatatoothy
    Mamamonkey

  3. #3
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    rscount?

    Code:
    For j = 1 To rsCount
    It looks to me as if rscount is not initialized. If it is zero when the For-Loop starts, you will skip to the Next.
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

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