Page 1 of 1

For-Next Issue

Posted: Fri Jan 24, 2014 6:07 am
by SMcClouth
Hey all,

I'm writing a small program in QB PDS in which I have the following code:

Code: Select all


For d = 1 To IDs
        If CU(d) = CUR Then
          CUC = CC(d)
        End if
Next
[*]CU(d) is an array containing certains IDs
[*]CUR is the main ID, we locate in the array to find CUC
[*]CUC is the ID to refere to another array, which is taken form CC(d) -> following the CU(d) list.

e.g. I have ID nr 5 and I need to find the ID for a student who is in Array2. If CU(d) = my id nr 5, then
CC(d) will have the ID for Array which then will give me the student's ID.

The thing is, I know that have a list of about 300 records and that the records CU(1-150) are ID nr 5. But instead
of starting at CU(1), it gives me CU(150).

Can someone shines his light upon this code?

Thx.

Re: For-Next Issue

Posted: Fri Jan 24, 2014 9:22 pm
by burger2227
What is IDS? The FOR loop will stop at that. Use EXIT FOR in an IF statement if you want it to exit early.

Re: For-Next Issue

Posted: Sat Jan 25, 2014 10:04 am
by SMcClouth
IDS is an integer which is the amount of data records (of which I have 300).