Forum Discussion
DDL Syntax
Hi,
> ALTER TABLE MyTableName ADD CONSTRAINT Check ( ( MyfieldName > 0 ) AND ( MyFieldName < 3500 ) )
1. You have to specify a name for the constraint.
2. You have to use ADO to add a Check constraint.
The VBA code could look like this:
CurrentProject.Connection.Execute "ALTER TABLE MyTableName ADD CONSTRAINT myConstraintName Check ( ( MyfieldName > 0 ) AND ( MyfieldName < 3500 ) )"
Servus
Karl
****************
Access News, Forever, DevCon
Access-Entwickler-Konferenz AEK - 19./20.10. Nürnberg
Thanks for your reply.
I had a name for my constraint. I was sloppy about not including it. Sorry about that.
Thanks for your input on this type of constraint requiring the use of ADO. Is there a reference somewhere about what things require ADO? It would be nice to know this kind of thing.
Thanks again!
Mike
- Jul 27, 2024
Hi,
I gave two conference presentations on this >20 years ago when JET4 (that brought the ADO pecularities) was still “fresh” and even then there wasn't much documentation on it. That has not improved. The only documentation to my knowledge still consists of these 3 texts:
Fundamental Microsoft Jet SQL for Access 2000
Intermediate Microsoft Jet SQL for Access 2000
Advanced Microsoft Jet SQL for Access 2000
In these texts, you then have to find out what only works via ADO and with which syntax.
Servus
Karl
****************
Access News, Forever, DevCon
Access-Entwickler-Konferenz AEK - 19./20.10. Nürnberg