YML File Toolbox -- The power of YML!

Why YAML? Simplicity meets Power! 💪

In Part 1, we looked at INI files -- a simple and proven solution for configuration management. In Part 2, we explored XML files -- powerful and versatile. Now it's time for the next evolution:
 
YML files!

Yes, INI files are great for simple settings, and XML is powerful. But YAML combines the best of both worlds:

Simple and readable: Clean syntax without excessive tags or brackets
Hierarchical structures: Just like XML, but much more elegant
UTF-8 support: All languages, special characters, and even emojis -- no problem!
Industry standard: Used by Docker, Kubernetes, Ansible, GitHub Actions
Human-friendly: Easy to read and write even for non-programmers
Compact: Less overhead than XML

 My conclusion: INI for ultra-simple cases, YAML when you need readability AND power!

  

📊 INI vs. XML vs. YAML -- The Big Comparison

Here's a comprehensive overview of all three formats:

Feature

INI Files

XML Files

YAML Files

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

✅ Yes (;)

✅ Yes (<!-- -->)

✅ Yes (#)

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?

Use INI when:

  • You need ultra-simple configuration (just key-value pairs)
  • Maximum performance is required
  • You're using Windows API
  • No hierarchy needed

Use XML when:

  • You need complex nested structures (>2 levels)
  • You're exchanging data with external systems
  • Schema validation is required
  • You need XSLT transformations
  • Industry standard compliance required

Use YAML when:

  • You want human-readable configuration
  • You need hierarchy AND readability
  • You're working with modern toolchains
  • You need arrays and data types
  • File size matters
  • You want easy version control


🧰 The complete YML File Toolbox – 13 powerful functions!

I've developed a comprehensive VBA library that brings YAML support to MS Access. XML. All functions use Late Binding (no references required) and work in all Access versions (32/64-bit).


📖 1. YML_ReadValue - Read values

The basic function for reading configuration values. 
strBackendPath = YML_ReadValue(strYmlPath, "Database", "BackendPath", "")


✍️ 2. YML_WriteValue - Write or update values

Saves values to the YML file. Automatically creates file and section if they don't exist! Special characters are automatically escaped. 
YML_WriteValue strYmlPath, "Database", "BackendPath", strSelectedPath


🖨️ 3. YML_PrintAll - Print complete file

Displays the entire content formatted in the Immediate Window -- perfect for debugging! 
YML_PrintAll CurrentProject.Path & "\config.yml"


📋 4. YML_GetSections - List all sections

Returns a collection of 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

Perfect for dynamic processing of all settings. 
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 entire section

Removes a complete configuration section. 
If YML_SectionExists(strXmlPath, "OldModule") Then
      YML_DeleteSection strYmlPath, "OldModule"  
End If


❌ 7. YML_DeleteKey - Delete a key

Deletes specific settings. 
YML_DeleteKey strYmlPath, "Session", "TempPassword"


✔️ 8. YML_SectionExists - Check section

Checks whether a configuration section exists. 
If Not YML_SectionExists(strYmlPath, "DatabaseV2") Then ...


✅ 9. YML_KeyExists - Check key

Checks whether a specific setting exists. 
If Not YML_KeyExists(strXmlPath, "Features", "AutoBackup") Then
      YML_WriteValue strXmlPath, "Features", "AutoBackup", "True"  
End If


🏗️ 10. YML_PrintStructured - Structured output

Displays the YML file in a hierarchical structure -- ideal for documentation! 
YML_PrintStructured strYmlPath


📦 11. YML_GetAllValues - Dictionary of all values

Retrieves all key-value pairs of a section as a dictionary -- super efficient! 
Set dictDB = YML_GetAllValues(strYmlPath, "Database")  
Debug.Print "Server: " & dictDB("Server")  
Debug.Print "Port: " & dictDB("Port")  
Debug.Print "Timeout: " & dictDB("Timeout")


🔍 12. YML_ValidateFormat - Format validation

Checks the YML file for errors: malformed XML, duplicate keys, missing attributes. 
If Not YML_ValidateFormat(strImportedYmlPath) Then
      MsgBox "The imported configuration is invalid!", vbCritical  
End If

Validation Checks:

  • File exists and is readable
  • YML is well-formed (correct syntax)
  • No duplicate sections
  • No duplicate keys within a section
  • All sections and keys have names


🔄 13. YML_Compare - Compare two YML files

THE HAMMER for versioning and migration management! 
If Not YML_Compare(strOldConfig, strNewConfig) Then
      Debug.Print "Changes detected - see details in Immediate Window"  
End If


Perfect for:

📊 Version comparison after updates
🔍 Troubleshooting configuration problems
📝 Documentation of changes
⚠️ Warning in case of critical deviations



🌍 Real-World Use Cases -- Beyond Configuration

Use Case 1: Multi-Backend Support (Classic)
 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

 

Use Case 2: Application Settings with Arrays

YAML is perfect for storing lists! Example: 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]"


Use Case 3: Export Templates for Reports

Store export settings (headers, formats, filters) in YAML and load them dynamically.

YML_WriteValue strYmlPath, "ReportTemplate_Sales", "Title", "Monthly Sales Report"
​YML_WriteValue strYmlPath, "ReportTemplate_Sales", "DateFormat", "DD.MM.YYYY"
​YML_WriteValue strYmlPath, "ReportTemplate_Sales", "Columns", "Date,Customer,Amount,Status"
​YML_WriteValue strYmlPath, "ReportTemplate_Sales", "SortBy", "Amount DESC"

Resulting YAML:
ReportTemplate_Sales:
​  Title: Monthly Sales Report
​  DateFormat: DD.MM.YYYY
​  Columns: "Date,Customer,Amount,Status"
​  SortBy: Amount DESC


Use Case 4: User Preferences with UTF-8

Perfect for international applications! All special characters work flawlessly.

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: YML remains intact during frontend updates
        UTF-8 support: All languages and special characters work perfectly
        Readable: Clean syntax without XML tags
        Industry standard: Used by Docker, Kubernetes, CI/CD pipelines
        Compact: Smaller file sizes than XML
        32/64-bit: Works in all Access versions
        No dependencies: Pure VBA (Late Binding), no references necessary
        Auto-escaping: Special characters (&, <, >, ", ') automatically handled
        Comments: Native support with # character
        Arrays: Inline arrays like [1, 2, 3]

⚠️ Important: Special Characters Handling

The module automatically escapes all special characters. You don't have to worry about it!

 

🔮 What’s next?

This completes my trilogy of configuration file formats!


🧪 Try it out

Using my little testing form you can try the functions directly. This makes it easy to learn the functions step by step. Do you develop a lot with Access? Then give it a try — I’m looking forward to your feedback or ideas for additional functions! 🚀



You will find the detailed description and all instructions directly in the code - well documented as usual.


 📥  DOWNLOAD  
Version: 1.0   18th December 2025



If you find it helpful and recognize its value, I would appreciate a small donation to reflect the effort and benefit it provides you PayPal A small donation