Running SQL from Visual Basic Code – Apostrophe problems!

I recently encountered a problem that I’ve actually encountered millions of times before – trying to run an SQL string from VBA code which makes use of double apostrophe’s (“”). Naturally, VBA uses these to break from a string literal, but pure Jet-SQL uses them for functions like Format() and Nz().

So if you do something like this:

strSqlCode = “Select format([field1], “Currency”) from table1″
db.execute strSqlCode

You will get a nice friendly Access message indicating that your SQL is faulty. Surely that ain’t the case!

There are several different solutions and here is one I find the most handy … Read the rest

Ms Access Tips

Hello valued reader!

Over the years, I’ve had the pleasure of doing quite a bit of work in Ms Access, and also in Visual Basic for Applications. On countless occasions I’ve benefited from the work of countless others who toil in this Rapid Application Development suite when I’ve encountered a hitch. I’ve always wanted to ‘give back’ some ideas in regards to my Ms Access experiences.

Therefore, I’ve decided to put some effort in putting up a few ‘tips’ or ‘shortcuts’ is an easy to access manner (no pun intended). These will be sometimes a few generic code snippets, sometimes … Read the rest