Ms Access Gurus      

Recursive Functions Presentation

A recursive function calls itself.

A good example is Allen Browne's code to list files. It saves file name and path (the recursive part) to a collection. Then it writes the results either to the Immediate window or the value list for a listbox on a form. Both of these ways of reporting are limited. I added a form to call Allen's code, and an optional feature to save the collection to a table.

Another use for a recursive function is tracing relationship paths from any beginning table through intermediate tables to an ending table. This uses words to describe the different table paths that relate your data.

{ image: Recursive Functions }

Quick Jump

Goto the Very Top  

Download

Presentation

Access Lunchtime hosted by Maria Barnes 24 Feb 2026

PDF with Slides

Recursive_presentation_s4p.pdf

Download ACCDB with Allen Browne's ListFiles and FillDir recursive code with a test form that also includes an option to save results to a table (43 kb)

Recursive_ListFiles_AllenB_s4p__ACCDB.zip

Download ACCDB to document relationship paths and other information to a table (39 kb)

Recursive_RelPath_s4p__ACCDB.zip

To use RelPath in your database import:

  1. s4p_RelPath table
  2. s4p_mod_RelPath_Recurse module

into your database. Compile, Save, and run DoRelPath_All_s4p OR DoRelPath_OneTable_s4p

filter for BatchID if you've run more than once

Remember to UNBLOCK files you download to remove the Mark of the Web if it is set. Here are steps to do that: https://msaccessgurus.com/MOTW_Unblock.htm

Video

click to watch on YouTube: Recursive Functions Presentation (52:55)

{ image: Recursive Functions Presentation Video }

Read the video description on YouTube for more information and links

Goto Top  

References

ListFiles by Allen Browne

Allen Browne's code, as he originally wrote it:

http://allenbrowne.com/ser-59.html

Relationship Paths

RelPath is covered more in-depth here, and hasn't changed. However, now form to run Allen's ListFiles code has options to write to a table and prompt for FileSpec — therefore, the presentation download version is better for Allen's tool — and also easier to isolate what you need to import to use RelPath.

https://msaccessgurus.com/tool/RelationshipPaths.htm

Goto Top  

Share with others

here's the link to copy:

https://msaccessgurus.com/presentation/Recursive_Functions.htm

Goto Top