Skip to content
Artwork for Computer Learning Zone
Computer Learning Zone · Yesterday · 23 min

Returning Multiple Values from Microsoft Access VBA Functions

Need one VBA routine to retrieve several related pieces of information, such as a customer's address, city, state, ZIP code, and country? This episode explores a clean Access VBA pattern for doing exactly that without scattering repeated DLookup code throughout your database. Using a Boolean function result for success or failure and ByRef parameters for the additional values, you can keep related lookup logic in one reusable place. The calling code stays readable, and it is easy to tell whether the customer record was found before using the returned data. We also discuss why multiple DLookups are still perfectly reasonable for simple one-off tasks, and where ByRef outputs fit compared with global variables and TempVars. It is another practical VBA tool for building Access applications that are easier to maintain later, especially when past-you forgot to leave comments.

0:00-23:47

transcript

No transcript — this publisher did not publish one.

show notes

Need one VBA routine to retrieve several related pieces of information, such as a customer's address, city, state, ZIP code, and country? This episode explores a clean Access VBA pattern for doing exactly that without scattering repeated DLookup code throughout your database.

Using a Boolean function result for success or failure and ByRef parameters for the additional values, you can keep related lookup logic in one reusable place. The calling code stays readable, and it is easy to tell whether the customer record was found before using the returned data.

We also discuss why multiple DLookups are still perfectly reasonable for simple one-off tasks, and where ByRef outputs fit compared with global variables and TempVars. It is another practical VBA tool for building Access applications that are easier to maintain later, especially when past-you forgot to leave comments.