SQL Helpers - Your little SQL toolbox for MS Access!


MS Access and SQL - they simply belong together. Anyone who develops regularly knows that there's no getting round it. And there's more: you write lots of SQL statements, debug laboriously, format values by hand ... that takes time and nerves. 😤

👉 But hey - that's exactly what the Developers SQL Helper is for!

It's a small, but nice module (not an Add-In) with functions that make my (and maybe soon your) day-to-day work much easier. 


🔍 Debugging made easy: checkSQL and debugSQL

Instead of Debug.Print strSQL simply use checkSQL(strSQL) or debugSQL(strSQL) – and you can immediately see what your SQL statement is doing.

 checkSQL(strSQL)
Generates a temporary query directly from your SQL statement (SELECT) and displays it - perfect for quick testing and customisation. Want to go even deeper? Then simply open it in design mode and fine-tune it directly and copy the finished SQL string from the SQL view

debugSQL(strSQL)
Formats statements such as SELECT, UPDATE, DELETE, INSERT INTO or CREATE TABLE clearly and legibly in the direct window. Super practical if you want to quickly understand exactly what the statement does - or where it gets stuck.


👉 A few examples of how the outputs look in the direct window:

---------------------------------------------------------------------

SELECT firstname, lastname FROM tblExample WHERE active = TRUE AND number < 10

 

Selected Fields:

  Field 1: firstname

  Field 2: lastname

---------------------------------------------------------------------

---------------------------------------------------------------------

UPDATE tblExample SET Value active=TRUE, number = 15 WHERE ID=3

 

Columns and Values:

  WHERE Clause: ID=3

  Value active = TRUE

  number = 15

---------------------------------------------------------------------

---------------------------------------------------------------------

INSERT INTO tblExample (firstname, lastname, street, postalcode, active, number, since)VALUES ('Christian', 'O''Hara', 'Tulpenweg 13', 12345, 'Hamburg',15,#2025-02-01#)

 

Columns and Values:

  firstname = 'Christian'

  lastname = 'O''Hara'

  street = 'Tulpenweg 13'

  postalcode = 12345

  active = 'Hamburg'

  number = 15

  since = #2025-02-01#

---------------------------------------------------------------------

---------------------------------------------------------------------

DELETE FROM tblExample WHERE ID = 10

 

DELETE FROM Table: tblExample

  WHERE Clause: ID = 10

---------------------------------------------------------------------

---------------------------------------------------------------------

CREATE TABLE tblTEST (ID INT, Name VARCHAR(100), Aktiv BIT)

 

CREATE TABLE: tblTEST

  Columns and Data Types:

    ID - INT

    Name - VARCHAR(100)

    Aktiv - BIT

---------------------------------------------------------------------



🪄The magician: cSQL() – the smart SQL converter

We are all familiar with type conversion functions such as CInt() or CDate(). - But now comes the game changer: cSQL()

This function automatically recognises the data type of a value and you never have to worry again whether your value is really SQL-ready:


  • "O'Hara" --> 'O''Hara'
  • #22.04.2025# --> #2025-04-22#
  • 3,14 --> 3.14
  • etc

No more troublesome formatting - just throw it in, it fits! 👌

Instead of: 

strSQL = "UPDATE tblExample SET Value name='O'''Hara', number= " & Replace(pi, ",", ".") & ", Date=#" & Format(myDate, "yyyy-mm-dd") & "# WHERE ID=3"

Simple use: 

strSQL = "UPDATE tblExample SET Value name=" & cSQL("O'Hara") & ", number= " & cSQL(pi) & ", Date=" & cSQL(myDate) & " WHERE ID=3"

Your advantage:

✅ Fewer errors 
✅ More readability 
✅ Faster coding


💡 Conclusion: 

Whether debugging or secure SQL values - the Developers SQL Helper is my personal toolbox for working efficiently in Access. Small tools, big impact. Can be used directly, no dependencies, 100 % VBA.

Do you develop a lot with Access? Then give it a try - I look forward to feedback or ideas for further functions! 🚀


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


   DOWNLOAD  
Version: 1.1   19th May 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