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

return values from sub

Status
Not open for further replies.

avivit

Technical User
Jul 5, 2000
456
IL
I need to call a sub field_AfterUpdate()
from another sub/function.
And I want to get back a value (true/false) from the
after_update sub, according to results of If's conditions.
I understand how to do it if the sub where a function,
but if it's a sub like this,
what do i do?
P.s - I also need to send the current content of the current
url field.
The question: can I leave things as they are and just
make all sub public and make global variables?
 
With Subs, if you pass parameters by reference (the default) then they chages are passed back to the variable.
Say you have:

Code:
Sub MyProc(varA, varB)

We can use varA to pass the data in, and varB to retrieve the results. You just set the value to varB in the sub, and the you get at the status in the calling code.
Its just like a function, but the variable is used in a different way/place.

James :) James Culshaw
jculshaw@active-data-solutions.co.uk
 
Ok. Thanks, Now...
1. it does not matter if the subs are public or private?
2. I want to use this sub , but sometimes I need it
to work just afer-update of a field in a a current record.
I.e - I want to use this sub when a certain field is in "after_update" condition,
and I also want to use it when, say, exiting the db
(for runing the tests on ALL records),
and for that I need to make a differnet sub, to run the db
and call this sub, but each time with the contnet of the
curent record.
So once I need the sub without sending and recieving values,
and on exit, I want it all.
What do you say? Possible?
 
It does matter if the sub is public or private. The subcan only be private if the calling function/sub is in the same module, otherwise it will have to be public.
What you want is possible but it will require a degree of coding skill and will be a tad painfull.

James :)
James Culshaw
jculshaw@active-data-solutions.co.uk
 
culshaja , Thanks anyway for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top