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 ...

Get Access 2002 Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.