Stuart McLachlan
stuart at lexacorp.com.pg
Wed Jun 24 16:47:11 CDT 2009
What's wrong with Do ... initial code here.... If <condition1> then 'else goto loop ...more code here.... If <condition2> then 'else goto loop ...more code here... End If End if Loop Again, the indentation from the IF...End IF makes the code much easier to follow that a flat sequence with a series of GOTOs hidden throughout. -- Stuart On 24 Jun 2009 at 13:54, Drew Wutka wrote: > A Do Loop cannot have extra 'loop' statements. > > Ie: > > Do > > 'some condition is met: then Loop > > Loop > > Can't do that. You can do that with a Goto statement. > > Drew > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte > Foust > Sent: Wednesday, June 24, 2009 11:52 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Learning .Net -- PHP Instead? > > A Do...Loop would be preferable to Goto. > > Charlotte > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka > Sent: Wednesday, June 24, 2009 8:27 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Learning .Net -- PHP Instead? > > I think it should be said that you shouldn't use GOTO to prevent > breaking your code into more logical parts. Errorhandling is a > situation which would allow Goto then. There is another situation. > Let's use an imaginary 'Phone' object that is going to make a call, and > it needs to try 20 times unless successful: > > Dim obj as Phone > Dim intTries as Long > Dim blFailed as Boolean > intTries=0 > Set obj=New Phone > > StartOfCall: > > blFailed=True > intTries=intTries+1 > If intTries=21 then Goto > > The information contained in this transmission is intended only for the person or entity > to which it is addressed and may contain II-VI Proprietary and/or II-VI Business > Sensitive material. If you are not the intended recipient, please contact the sender > immediately and destroy the material in its entirety, whether electronic or hard copy. > You are notified that any review, retransmission, copying, disclosure, dissemination, > or other use of, or taking of any action in reliance upon this information by persons > or entities other than the intended recipient is prohibited. > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com