Jamie Collins said:
You know you can create a CHECK constraint in the interface of Access
while in ANSI-92 mode. Therefore, check constraints *can* be achieved
within the context (e.g. ADO) and interface (e.g. ANSI-92 mode) of
Access.
I wasn't aware of that. Where in the interface can you do that? Or do
you mean that the interface allows you to execute DDL to that effect,
in
stead of having to execute through ADO/OLE DB
If we only had Access 2000 and the Jet 4.0 goodies were only
available via ADO I can see it would be difficult to convince a
long-time Access user to utilize them. However, we have Access 2002
and Access 2003 with ANSI-92 mode (previously known as 'ANSI query
mode').
Which of my 'Jet suggestions' are not supported by Access while in
ANSI-92 mode? I can't think of any.
Swithching to ANSI-92 mode in an old Access app, in itself might answer
some of that question. This will break the "Access SQL dialect", but
whether or not that's a bad thing, belongs to another discussion ;-),
but it might also break existing queries. More "amusing", and unhealthy
for employment, is possible consequenses of executing queries doing
calculations, due to differences in execution between the modes.
Even in ANSI-92 mode, the behaviour when copying tables are different
when you're using the unsupported Jet feature check constraints than
when not. For those using such methods for maintenance, backup,
recovery, updates... this is broken when check constraints are
utilized.
I can't bring myself to call it supported by Access. Sure you can run
DDL, but in a visual/graphic interface like Access, I wouldn't call
such
settings supported unless you can find it somewhere in the UI and be
able to select it, alter or delete it. I haven't found such. Like, if
you fire off a check constraint on SQL server, then you will find that
constraint listed in the UI of most tools you use. For instance in SQL
Server Management Studio Express, it is a property/folder of the table,
in which you can add, alter and delete it through the UI (and, there's
a
wizard).
ADO is kind of "standard", and we were exposed to massive marketing
some
time ago, but one might question the success of this, since it seems
ADO
is frowned upon when working with Access/Jet, the preference is the
more
native DAO. In the following branch of a thread (where you also
participated elsethreads), some of these views and reservations are
expressed in relation to some ADO/DDL.
http://groups.google.com/group/comp..._frm/thread/60421a637345a4f9/31dc17a7dcd80b6c
Then I'm going to aim a bit low. I've read several of your replies in
these NGs, and it seems some of the suggestions you've given, might
break some of the reasons for choosing Access. Here's one sample with a
"groan" ;-)
http://groups.google.com/group/microsoft.public.access.tablesdbdesign/msg/df29dea99f93f956
If using check constraints, and implementing engine level validation
and
constraints means to toss bound forms overboard, then it also means
tossing Access overboard as frontend.
Bound forms are a core functionality or Access, it's what Access is
designed for, and what makes Access the brilliant RAD tool it is. If
going unbound is what one has to do to be able to use engine level
validation, then using these kind of constraints rules out Access as
front end. This is what I've been trying to say - I perceive it to be a
mismatch between your enthusiasm for engine level stuff and usage of
the
product for which this NG is dedicated. Stuffing everything into the
engine will either force users to become scripting masochists - and
hey,
aren't we living in the time of graphic intefaces now - or that they
just throw Access out with the bathwater. You are a bit more to the
point in this comment
http://groups.google.com/group/microsoft.public.access/msg/d3b7b020c625ff8b
<ot>I think you can do pretty much what you ask for there with ADO form
recordset within a transaction and 2002 and later versions, but you
probably know about that</ot>
So, unless there are interesting changes in the 2007 version, I don't
foresee a rush among Access developers to utilze check constraints.
If Jet 4.0 is not for
Access users then who?
Jet 4.0 is a very good backend database for a lot of different
purposes.
Connecting to a Jet database from Word, Excel, from systems built with
(Classic) VB, VB.Net, ASP, C#, different script technologies and all
the
things I've forgotten... There are quite a lot of Jet databases out
there where the main means of usage are through technologies that has
nothing to do with Access.
In that context, I too utilize features of the engine that aren't
supported by Access in default operating mode, since basically, in this
context Access isn't involved in normal day to day operation so
whatever
limitations Access might have aren't relevant.
That is a misstatement, presumably unintentional.
Yup - lack of language skills
You picked a good example. I think many people who use this setting
would be surprised it will not prevent:
INSERT INTO (my_text_col) VALUES ('');
It does prevent that on my setups (2000/2002/2003), unless I've
misunderstood.
I'd be happy to know under which circumstances it has problems. Here's
test code with the excact same result on 2000, 2002 and 2003, in the
latter two, regardless of ANSI mode ;-)
Sub ZLSPropertyTest()
Dim cn As ADODB.Connection
Set cn = CurrentProject.Connection
'cn.Execute "DROP TABLE zlsTest"
cn.Execute "CREATE TABLE zlsTest (" & _
"id Int Identity PRIMARY KEY, " & _
"testText Varchar(25) NOT NULL UNIQUE)"
With CreateObject("ADOX.Catalog")
Set .ActiveConnection = cn
.Tables("zlsTest").Columns("testText").Properties( _
"Jet OLEDB:Allow Zero Length").Value = False
End With
On Error Resume Next
DBEngine(0)(0).Execute "INSERT INTO zlsTest (testText) " & _
"VALUES ('')", dbFailOnError
Debug.Print Err.Number, Err.Description
Err.Clear
cn.Execute "INSERT INTO zlsTest (testText) " & _
"VALUES ('')"
Debug.Print Err.Number, Err.Description
Err.Clear
End Sub
Immediate pane shows
3315 Field 'zlsTest.testText' cannot be a zero-length string.
-2147467259 Field 'zlsTest.testText' cannot be a zero-length string.