Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A new thing (as far as i am concerned) with Multiple Loop 2

Status
Not open for further replies.

PraveenMenon

Programmer
Oct 19, 2002
208
IN
if you are using a nested for loop, we usually do this
'======================
For i=0 to 20
For j=0 to 20
Debug.Print i,j
Next j
Next i

'======================

we can also do this
For i=0 to 20
For j=0 to 20
Debug.Print i,j
Next j,i
'======================

Is it new? let me know Pls.
All the Best
Praveen Menon
pcmin@rediffmail.com
 
I didn't know you could do this, but I still prefer the old way. I like to see the Next statement lined up with the For, as far as indenting is concerned. Makes for easier reading.

 
Well its just an information DrJavaJoe... I accept your point, and admit even i am still on the classic way of doing this...I didnt mean to say "all u people must use this from now!"... I just wanted to share what i figured is possible. All the Best
Praveen Menon
pcmin@rediffmail.com
 
Classic is great. But this information help my code for it makes my code a little bit short. Actually i have a code like this.

Function CCAPrefix(vCCACount As Long) As String
'Combination for AAA to ZZZ
Dim ascCounter, ascCounter2, ascCounter3, vCount
For ascCounter = 65 To 90 'A to Z
For ascCounter2 = 65 To 90 'A to Z
For ascCounter3 = 65 To 90 'A to Z
vCount = 1 + vCount
If vCount = vCCACount Then
CCAPrefix = Chr(ascCounter) & Chr(ascCounter2)
Exit Function
End If
Next asCounter3, ascCounter2, ascCounter
End Function

This look a little bit cute. Actually most of the time i used shorter code as possible. Like when I passed values to a set of variables i do something like this below

dim varA, varB, varC
set rs= nothing
rs.open "select A, B, C, from Tables",db
if rs.recordcount>0 then
varA=rs!A: varB=rs!B: varC=rs!C <<-- i use this

rather than this below
varA=rs!A
varB=rs!B
varC=rs!C
endif

Please pardon the grammar.
Not good in english.
 
I forgot to say thank you for the TIPS Please pardon the grammar.
Not good in english.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top