INI File Toolbox โ€“ complete solution for configuration management!

Why INI files? The underestimated power for Access developers! ๐Ÿ’ช

As Access developers, we are constantly faced with the same question: Where is the best place to store user settings, configurations, and paths?

The obvious answer is: in the database itself.

And yes โ€“ this works great in many scenarios. But in practice, it quickly becomes apparent that I still can't do without external files.

I divide my applications into frontend and backend in the traditional way. The frontend contains a settings table where I save the path to the backend. When the application is first started, this path is still empty, so the user is presented with a file dialog and selects the backend. The path is then saved โ€“ conveniently and reliably, without having to reconnect each time.

So far, so good. So why add an INI file?

The crux of the matter: as soon as I roll out an update to the frontend, the internal settings table is back to square one โ€“ the path would be gone. So I also save the backend path externally in a small INI file. For users, this means no more dialog boxes, no confusion, just business as usual.

And why an INI-file?

Because it is a simple, robust format that has been doing what it is supposed to do reliably for decades. For configurations that need to remain stable, it is often the most pragmatic solution.

 

My conclusion:

Sometimes, the best decision is not โ€œeither/or,โ€ but a clever combination of both worlds.


๐ŸŽฏ The game changer: updates without data loss! 

My proven start workflow in practice 

1. Frontend starts
2. Check backend path in frontend table
3. Path invalid? โ†’ Read INI file
4. INI found? โ†’ Connect backend automatically
5. No INI? โ†’ Show file dialog (only on first start), save path in FE and INI file
6. Delete existing linked tables
7. Relink all backend tables (so they are always up to date with the latest backend version)

After an update, the application starts immediately with the saved settings โ€“ no annoying dialogs, no support effort!

I will publish an article about my frontend start function (FE/BE link, license check, hiding the menu bar, etc.) at a later date.

 

๐Ÿงฐ The complete INI File Toolbox โ€“ 13 powerful functions! 

I have developed a comprehensive VBA library that covers EVERYTHING related to INI files. Not just my use case for the backend connection:

๐Ÿ“– 1. INI_ReadValue - Read values

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


โœ๏ธ 2. INI_WriteValue - write or update values

Saves values to the INI file. Automatically creates file and section if they don't exist!

INI_WriteValue strIniPath, "Database", "BackendPath", strSelectedPath


๐Ÿ–จ๏ธ 3. INI_PrintAll - Print complete file

Displays the entire content formatted in the Immediate Window โ€“ perfect for debguggin!

INI_PrintAll CurrentProject.Path & "\config.ini"


๐Ÿ“‹ 4. INI_GetSections - List all sections

Returns a collection of all sections.

Set colSections = INI_GetSections(strIniPath)
For Each varSection In colSections
    Debug.Print "Gefundene Sektion: " & varSection
Next


๐Ÿ”‘ 5. INI_GetKeys - List all keys of a section

Perfect for dynamic processing of all settings. 
Set colKeys = INI_GetKeys(strIniPath, "Database")
For Each varKey In colKeys
    Debug.Print varKey & " = " & INI_ReadValue(strIniPath, "Database", CStr(varKey))
Next


๐Ÿ—‘๏ธ 6. INI_DeleteSection -Delete whole section

Removes an entire configuration section. 

If INI_SectionExists(strIniPath, "OldModule") Then
    INI_DeleteSection strIniPath, "OldModule"
End If


โŒ 7. INI_DeleteKey -Delete a key

Deletes specific settings.

INI_DeleteKey strIniPath, "Session", "TempPassword"


โœ”๏ธ 8. INI_SectionExists - Checks a section

Checks if a section exists.

If Not INI_SectionExists(strIniPath, "DatabaseV2") Then โ€ฆ


โœ… 9. INI_KeyExists - Checks a key

Checks whether a configuration area exists.

If Not INI_KeyExists(strIniPath, "Features", "AutoBackup") Then
    INI_WriteValue strIniPath, "Features", "AutoBackup", "True"
End If


๐Ÿ—๏ธ 10. INI_PrintStructured - Print structured

Displays the INI file in a hierarchical structure โ€“ ideal for documentation!

INI_PrintStructured strIniPath


๐Ÿ“ฆ 11. INI_GetAllValues - Dictionary all values

Retrieves all key-value pairs of a section as a dictionary โ€“ super efficient!

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


๐Ÿ” 12. INI_ValidateFormat - Format validation

Checks the INI file for errors: missing brackets, duplicate keys, invalid syntax.

If Not INI_ValidateFormat(strImportedIniPath) Then
    MsgBox "Die importierte Konfiguration ist fehlerhaft!", vbCritical
End If

Validation Checks:

  • โœ“ File exists and is readable
  • โœ“ Sections are formatted correctly [SectionName]
  • โœ“ No duplicate sections
  • โœ“ No duplicate keys within a section
  • โœ“ Key-value pairs contain =
  • โœ“ No excessively long lines (>1000 characters)


๐Ÿ”„ 13. INI_Compare - Compare two INI files

THE BEST for versioning and migration management!

If Not INI_Compare(strOldConfig, strNewConfig) Then
    Debug.Print "ร„nderungen erkannt - siehe Details im Immediate Window"
     ' Shows detailed:
     ' - New sections
     ' - Removed sections
     ' - Changed values
     ' - New/deleted keys
End If

Perfect for:

  • ๐Ÿ“Š Version comparison after updates
  • ๐Ÿ” Troubleshooting configuration problems
  • ๐Ÿ“ Documentation of changes
  • โš ๏ธ Warning in case of critical deviations


๐ŸŒ Real-World Use Cases 

Use Case 1: Multi-Backend-Support

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

Use Case 2: User-specific settings

INI_WriteValue strIniPath, "UI", "Language", "DE"
INI_WriteValue strIniPath, "UI", "Theme", "Dark"
INI_WriteValue strIniPath, "UI", "FontSize", "12"
INI_WriteValue strIniPath, "Export", "DefaultFolder", "C:\Users\Marcus\Exports"


โœจ The advantages at a glance

โœ… Update-proof: INI remains intact during front-end updates
โœ… User-friendly: No repeated entries after updates
โœ… Robust: Windows API โ€“ proven for decades
โœ… Portable: Simple text files, usable anywhere 
โœ… Debuggable: Open and check directly in the editor
โœ… 32/64-bit: Works in all Access versions
โœ… No dependencies: Only Windows API, no references necessary

 

๐Ÿ”ฎ Whatโ€™s next? 

In an upcoming article, I'll show you a tool for automatic backend connections at startup โ€“ with support for multiple backends simultaneously, fallback strategies, and error handling. INI files are the perfect foundation for this!


๐Ÿงช 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   26th November 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