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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relatively easy design question

Status
Not open for further replies.

Ogart

Technical User
Mar 26, 2003
104
US
Relatively easy design question

Related to an earlier post. I've got a bunch of input fields. And these drive some non-trivial calculations. A!FlowRate, for example, is a deal breaker. If that is zero, I don't even want to bother calculating anything.

Is this appropriate design?
Public Sub BlahBlahBlah()
If A!FlowRate = 0 Then
End Sub
Else
'Do the rest of the subroutine
End if
End Sub
(Yes, A is a form).

The book I have is great on Syntax (you mean they tax that too??), but like all books can't give you a lot of interactive design choice help.

Much Appreciated.

Chris

-->Just because you can, doesn't mean you should.
 
instead of having the end sub why not.....

Public Sub BlahBlahBlah()
If A!FlowRate != 0 Then
'Do the rest of the subroutine
End if
End Sub
 
sorry about the above code ...should be

instead of having the end sub why not.....

Public Sub BlahBlahBlah()
If A!FlowRate <> 0 Then
'Do the rest of the subroutine
End if
End Sub


too much C++...
 
Duh. That makes sense.

From a pure syntax perspective, is my original idea bad bongs (having an end sub before the end if). Haven't tried it out for real, a bit scared too. Bad memories of a bad programming teacher in high school.

Thanks for the reply!

-->Just because you can, doesn't mean you should.
 
It all depends on who you ask.

You actually cant have an end sub statment like you have in the coding. It will produce an error while the code is compiling cause it doesnt check if statment at that time, it simply thinks that it is just he end of the sub procedure. You can have an exit sub statment though.

anyways i try to steer clear of doing that, obviously you might run into certain programming problems where you cant get around using exit subs or what not. In your case above i dont like doing it the way you originally showed cause why have it??? Just a waste of lines.
 
Makes sense. Thanks for the help Jooky. Worked like a charm.

-->Just because you can, doesn't mean you should.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top