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

Public, Private, Sub, Function, Property?

Status
Not open for further replies.

Petemush

Technical User
Jun 21, 2002
255
GB
I've had a quick look in the FAQ but can't find anything, apologise if this has been answered in a thread before.

When I go to create a new Procedure, I have no idea why I should create a Function instead of a sub and why it should be public instead of private and vice versa for everything.

Can anyone explain when and where I should use what?

Cheers,

Pete
 
1) A sub is a normal procedure
2) A function is a procedure with a result ... like Result = MyFunction(Parameter1, Parameter2)
3) Private and public keywords are used to mark a sub or a function as private to its scope or as public respectively. For example if you put a private function into a form, you can ONLY use this function inside this form. If you put a public sub in a module, you can use this function from ANYWHERE.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top