Hi ,
I am reading an access book and have come accross some code for a FOR NEXT statement.
Please could someone explain the process of what is being done below?
For i = 1 To 10000
For j = 1 To 10000
sExplicit = i / 0.33333
Next j
Next i
Hi ,
I am reading an access book and have come accross some code for a FOR NEXT statement.
Please could someone explain the process of what is being done below?
For i = 1 To 10000
For j = 1 To 10000
sExplicit = i / 0.33333
Next j
Next i
It doesn't make much sense like that, but generally the first time through i will be 1, so the variable named sExplicit will be set to the mathematical result of 1 divided by .33333. The second pass through i will be equal to 2, so the variable will be set to 2/.33333, and so on.
My (additional) $.02
It is a form of looping. It is easier to see if formatted:
There are two loops: i (the outer loop) & j (the inner loop). The inner loop, j, executes 10,000 times for each value of i, the outer loop. If you added code to add a record for each calculated value of "sExplicit", your table would end up with 100,000,000 new records (10,000 X 10,000).Code:For i = 1 To 10000 'outer loop For j = 1 To 10000 'inner loop sExplicit = i / 0.33333 Next j Next i