VBA – Run Time Error 3271 using DAO object

You’re facing a limitation of Access SQL text parameters. They can not accommodate string values longer than 255 characters. Here is a simple example which demonstrates the problem. Dim db As DAO.Database Dim qdf As DAO.QueryDef Dim strUpdate As String Dim strLongString As String strLongString = String(300, “x”) strUpdate = “UPDATE tblFoo SET memo_field = … Read more

CONCAT equivalent in MS Access

There are two concatenation operators available in Access: +; and &. They differ in how they deal with Null. “foo” + Null returns Null “foo” & Null returns “foo” So if you want to update Null [My Column] fields to contain “Prefix ” afterwards, use … SET [My Column] = “Prefix ” & [My Column] … Read more