YAML File Toolbox for MS Access – Readable AND Powerful

INI is simple, XML is powerful – YAML combines the best of both worlds: clean, human-readable syntax with hierarchical structures, arrays and UTF-8. This VBA toolbox brings YAML to MS Access: 13 functions, pure VBA, 32/64-bit.

In Part 1 we looked at INI files, in Part 2 at XML. Now comes the next evolution: YAML. INI is great for simple settings, XML is powerful – but YAML combines the best of both worlds:

  • Simple and readable – clean syntax without excessive tags or brackets.
  • Hierarchical – just like XML, but much more elegant.
  • UTF-8 – all languages, special characters and emojis.
  • Industry standard – Docker, Kubernetes, Ansible, GitHub Actions.
  • Compact – less overhead than XML.

INI vs. XML vs. YAML – the big comparison

Feature INI XML YAML
Readability ⭐⭐⭐⭐⭐ excellent ⭐⭐⭐ good ⭐⭐⭐⭐⭐ excellent
File size ⭐⭐⭐⭐⭐ very small ⭐⭐ large ⭐⭐⭐⭐ small
Learning curve ⭐⭐⭐⭐⭐ very easy ⭐⭐⭐ medium ⭐⭐⭐⭐ easy
Hierarchy ❌ only 2 levels βœ… unlimited βœ… unlimited
UTF-8 support ⚠️ limited βœ… full βœ… full
Comments βœ… ; βœ… <!-- --> βœ… #
Data types ❌ only strings ⚠️ with schema βœ… built-in
Arrays/lists ❌ no ⚠️ verbose βœ… native
Validation ❌ no βœ… schema (XSD) βœ… schema (JSON)
Industry adoption ⭐⭐⭐ legacy ⭐⭐⭐⭐ high ⭐⭐⭐⭐⭐ very high
Windows native βœ… built-in API βœ… MSXML ❌ no native
Speed (VBA) ⭐⭐⭐⭐⭐ very fast ⭐⭐⭐ medium ⭐⭐⭐⭐ fast
Best for simple configs complex data exchange modern configs

When to use what?

  • INI – ultra-simple configuration (just key-value), maximum performance, no hierarchy.
  • XML – complex nested structures (> 2 levels), data exchange with external systems, schema validation, XSLT.
  • YAML – human-readable configuration with hierarchy, modern toolchains, arrays and data types, small files, easy version control.

The 13 functions of the toolbox

All functions use late binding (no references required) and work in all Access versions (32/64-bit).

1. YML_ReadValue – read values.

strBackendPath = YML_ReadValue(strYmlPath, "Database", "BackendPath", "")

2. YML_WriteValue – write/update values. Creates the file and section automatically; special characters are escaped automatically.

YML_WriteValue strYmlPath, "Database", "BackendPath", strSelectedPath

3. YML_PrintAll – print the complete file.

YML_PrintAll CurrentProject.Path & "\config.yml"

4. YML_GetSections – list all sections.

Set colSections = YML_GetSections(strYmlPath)
For Each varSection In colSections
    Debug.Print "Found section: " & varSection
Next

5. YML_GetKeys – all keys of a section.

Set colKeys = YML_GetKeys(strYmlPath, "Database")
For Each varKey In colKeys
    Debug.Print varKey & " = " & YML_ReadValue(strYmlPath, "Database", CStr(varKey))
Next

6. YML_DeleteSection – delete an entire section.

If YML_SectionExists(strYmlPath, "OldModule") Then
    YML_DeleteSection strYmlPath, "OldModule"
End If

7. YML_DeleteKey – delete a single key.

YML_DeleteKey strYmlPath, "Session", "TempPassword"

8. YML_SectionExists – check a section.

If Not YML_SectionExists(strYmlPath, "DatabaseV2") Then
    ' create the section ...
End If

9. YML_KeyExists – check a key.

If Not YML_KeyExists(strYmlPath, "Features", "AutoBackup") Then
    YML_WriteValue strYmlPath, "Features", "AutoBackup", "True"
End If

10. YML_PrintStructured – structured output.

YML_PrintStructured strYmlPath

11. YML_GetAllValues – dictionary of all values.

Set dictDB = YML_GetAllValues(strYmlPath, "Database")
Debug.Print "Server: " & dictDB("Server")
Debug.Print "Port: " & dictDB("Port")
Debug.Print "Timeout: " & dictDB("Timeout")

12. YML_ValidateFormat – validate the format.

If Not YML_ValidateFormat(strImportedYmlPath) Then
    MsgBox "The imported configuration is invalid!", vbCritical
End If

Checks include: file exists and is readable Β· YAML is well-formed Β· no duplicate sections Β· no duplicate keys within a section Β· all sections and keys have names.

13. YML_Compare – compare two YAML files.

If Not YML_Compare(strOldConfig, strNewConfig) Then
    Debug.Print "Changes detected - see details in the Immediate Window"
End If

Real-world use cases

Multi-backend support:

YML_WriteValue strYmlPath, "Backends", "Production", "\\Server\DB\Prod.accdb"
YML_WriteValue strYmlPath, "Backends", "Test", "\\Server\DB\Test.accdb"
YML_WriteValue strYmlPath, "Backends", "Development", "C:\Dev\DB.accdb"
YML_WriteValue strYmlPath, "Settings", "CurrentEnvironment", "Production"

Resulting YAML:

Backends:
  Production: "\\\\Server\\DB\\Prod.accdb"
  Test: "\\\\Server\\DB\\Test.accdb"
  Development: "C:\\Dev\\DB.accdb"
Settings:
  CurrentEnvironment: Production

Settings with arrays – YAML is perfect for lists (color themes, server lists, feature flags):

YML_WriteValue strYmlPath, "UI", "AvailableThemes", "[Light, Dark, HighContrast]"
YML_WriteValue strYmlPath, "UI", "CurrentTheme", "Dark"
YML_WriteValue strYmlPath, "UI", "PrimaryColors", "[#FF0000, #00FF00, #0000FF]"

Resulting YAML:

UI:
  AvailableThemes: "[Light, Dark, HighContrast]"
  CurrentTheme: Dark
  PrimaryColors: "[#FF0000, #00FF00, #0000FF]"

User preferences with UTF-8:

YML_WriteValue strYmlPath, "UI", "Language", "DE"
YML_WriteValue strYmlPath, "UI", "Theme", "Dark"
YML_WriteValue strYmlPath, "UI", "WelcomeMessage", "Willkommen zurΓΌck, MΓΌller!"
YML_WriteValue strYmlPath, "Export", "DefaultFolder", "C:\Users\Marcus\Exports"

Resulting YAML:

UI:
  Language: DE
  Theme: Dark
  WelcomeMessage: "Willkommen zurΓΌck, MΓΌller!"
Export:
  DefaultFolder: "C:\\Users\\Marcus\\Exports"

The advantages at a glance

  • Update-proof, UTF-8 capable and readable (clean syntax without XML tags).
  • Industry standard (Docker, Kubernetes, CI/CD) and compact (smaller than XML).
  • 32/64-bit, no dependencies (pure VBA, late binding), with auto-escaping, comments (#) and inline arrays like [1, 2, 3].

This completes the trilogy on configuration file formats – INI, XML and YAML. Depending on your use case, you now have the right tool.

Just give it a try

Using the included testing form you can try the functions directly. You’ll find the detailed description directly in the code, well documented as usual.

Download

A VBA toolbox for MS Access with 13 functions for YAML files: readable and hierarchical, with arrays and UTF-8 – read, write, validate and compare, without any references.

βœ• Newsletter

Newsletter