Question to A2K7 users:
Does the new version of DAO (with the different name) correct those
deficiencies, i.e., providing full DAO creation/manipulation for all
ACCDB data types?
While the support for data type synonyms in ACEDAO SQL DDL is
improved, it's still not up to the rich ANSI-92 Query Mode SQL DDL
syntax as used by the OLE DB provider (e.g. via ADO). For example:
CurrentDb.Execute "CREATE TABLE test81 (text_col CHAR(2));"
CurrentDb.Execute "CREATE TABLE test82 (text_col CHAR(2) WITH
COMPRESSION);"
CurrentDb.Execute "CREATE TABLE test82 (text_col CHAR(2),
CHECK(text_col LIKE '[0-9][0-9]'));"
Only the first statement will execute without error. No such problems
with ADO:
CurrentProject.Connection.Execute "CREATE TABLE test92 (text_col
CHAR(2) WITH COMPRESSION);"
CurrentProject.Connection.Execute "CREATE TABLE test93 (text_col
CHAR(4), CHECK(text_col LIKE '[0-9][0-9]'));"
Mostly, opt for DAO, and only use ADO for the data types and
operations that Microsoft willfully chose to leave out of DAO3.6
and put into ADO instead.
Good advice
Now we're agreed that there remains a need and
legitimate reason for users to be using ADO and SQL-92 Query Mode
syntax, one should consider this when writing SQL that will be stored
in database objects (tables, Queries, VIEWs, PROCEDURES, etc), with
particular attention to wildcard characters. A quick example: consider
a validation rule to ensure the first letter of a column value is
always 'F' (case-insensitive):
[field_name] LIKE 'F*'
Using ADO, one could INSERT the literal value 'F*', not the designer's
intention. This is because the ANSI-92 Query Mode wildcard character
equivalent to '*' is '%'. In the past I've suggested coding for both
e.g.
([field_name] LIKE 'F*' OR [field_name] LIKE 'F%')
AND [field_name] <> 'F*'
AND [field_name] <> 'F%'
However, I've recently be made aware of the ALIKE operator which
allows ANSI SQL-92 wildcard characters to be used and honoured
regardless of Query Mode e.g.
[field_name] ALIKE 'F%'
Jamie.
--