Functions Versus Subs
You have already examined some of the differences between functions and subs. Functions return values; subs don’t return anything. Functions can be called from almost any place in Access, but because sub procedures are not used in expressions, you typically call sub procedures from an event (on a form or report), a function, or another sub procedure. For example, because sub procedures do not return a value, they cannot be used on the right side of an expression the same way you use any intrinsic functions such as Left or Len. For the same reason, you cannot call a sub procedure by assigning it to a variable. Furthermore, if you tried to use a sub procedure with an argument in a place that you normally use a function, such ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access