Access development: syntax of sql queries in VBA

One of the toughest things to do when coding VBA in Access development projects is coming to terms with SQL queries.
I've found following tips and tricks helpful :

SQL2VBA form

Allen Browne, one of the main authorities on the matter, proposes a form with VBA code which actually does the hard coding into VBA of any SQL string of your choice.
You'll find the code and procedure at his site: http://allenbrowne.com/ser-71.html

Another thing you might have ran into is using query parameters into SQL strings. Well you can't basically, you must 'transform' them and here is how: http://www.mvps.org/access/queries/qry0013.htm. If you run into the error "Queries: Too few parameters, expected n" - that's exactly what I'm referring too here :-).

And this might come in handy too: some basic testing for empty recordsets - as when your SQL query doesn't return records in the recordset, you'll off into problem land as well.
I've found this one useful to solve this issue: http://bytes.com/topic/access/insights/632600-testing-empty-recordset

Posted on 12 Apr 2010 · (0) Comments ·
Next entry: Excel Pivot Tables unplugged: hide items in a filter combo Previous entry: Boot disk