[AccessD] Learning .Net -- PHP Instead?

Charlotte Foust cfoust at infostatsystems.com
Wed Jun 24 11:51:47 CDT 2009


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
Obj.Reset
Obj.PickUpReceiver
If Not Obj.HasDialTone then Goto StartOfCall Obj.DialNumber
"972-555-5555"
If Not Obj.RingingOtherLine then goto StartOfCall While
obj.RingingOtherLine
	'Some Time Event
	'TimeEventOver 
	Goto StartOfCall
Wend
If obj.OtherSideConnected then
	Obj.NegotiateConnection
Else
	Goto StartOfCall
End If
If obj.NegotiatedConnection then
	Obj.SendData
Else
	Goto StartOfCall
End if
If Obj.DataSentSuccessfully then
	blFailed=False
else
	Goto StartOfCall
End if

EndOfCall:


So in the example above, a specific steps of a process needed to be run
in a particular order, and if any one step fails, it needs to start from
the beginning. Which is almost the opposite of ErrorHandling.  With an
ErrorHandling, if a step fails, it jumps to a new process that either
fixes the error and resumes the code, or does some clean up and ends the
process.  To do something like this without a goto statement would
require a lot of extra logic statements to determine if the previous
steps worked or not.

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 9:32 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Learning .Net -- PHP Instead?

It is useful in Access because it's the only way to implement error
handling.  For any other use, it should be banned by law!

Charlotte Foust 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Tuesday, June 23, 2009 1:59 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Learning .Net -- PHP Instead?

Only in his opinion and he is dead.

In my opinion it works just fine.  Is a useful tool and should be
retained to avoid unnecessary convolution in code.

cOdD was a purist but how many of use go to full granularity?  Not many,
I will be bound.

Max

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




More information about the AccessD mailing list