A family of Microsoft relational database management systems designed for ease of use.
I need to filter by fields containing a zero length string. I can make it work when writing the SQL in the SQL view of a query but I can't seem to get the syntax right when building the SQL in VBA - it never quite returns "" which is what works in the query. Can someone help? I've tried """" and '""' and "''" etc. Some combinations confuse the concatenation of the strings in vba too.
Probably the easiest thing to do is use single quotes (') to delimit the zero-length string inside the doubel-quoted string literal. That avoids any confusion. Something like this:
Dim strSQL As String
strSQL = "SELECT * FROM MyTable WHERE MyStringField = '';"
I put in the semicolon at the end of the statement, even though it's not required, just so you could clearly see the single-quotes. Note that it may not be obvious that those are single-quotes, unless you display the statement in a fixed-pitch font.
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html