Let's say you have created this function or a much more elaborate one. After you have performed the manipulation of data you have to make an assignment of the result to the name of the Function.(see Red)
Function YourFunction()
vVariable = X * Y YourFunction = vVariable
End Function
Now in an Control Source, Event Procedure's VBA code, a query etc. you make a call to that function like this: YourFunction()
The value of vVariable or (X * Y) will be returned. Bob Scriver
Many many Thanks KornGeek and scriverb
I needed the help. Seem a little more difficult learning !Basic! when you programmed in C for years.. tis a strange language
Mike
Just a note. Does this mean a function can only return 1 value.. Also I make sure that all form I reference are opened (normally hidden) but am still getting some errors (Access Can't find form etc.)
Can I alter the Table directly and update ( ? Requery ) before the user can do anything?
scriverb,
Thank you for so eloquently making the point that I was trying to make. I'm a little fuzzy-headed from too many late nights, and so my communications aren't as clear as I'd like them to be.
realm22,
A function can only return a single value, however you can modify the parameters that are passed to it, which has the effect of other returned values. (I believe this is the same in C, isn't it?)
For example:
Function MyFunkyFunction(ValA, ValB)
'This is a variation of one of the first functions I ever wrote
'It was for extra credit in a programming class.
ValA = ValA + ValB
ValB = ValA - ValB
ValA = ValA - ValB
MyFunkyFunction = ValA + ValB
End Function
The function would only return the value of ValA + ValB, but in the process, ValA and ValB would be swapped.
Yep… Same in C. I am so use to C that I can modify the whole world from inside a function it doesn’t seem so restricted. I suppose the beauty of passing a pointer to a structure and being able to modify the contents of the structure give the appearance of… but I suppose Basic, once you master it can do the same.
It all boils down to learning more Basic. What I need is a C to Basic compiler
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.