Re: Query to add Foreign Key constraint to existing tables?




Francisco Garcia wrote:
> In C#, I use the "Microsoft.Jet.OLEDB.4.0" managed provider.

Do you mean System.Data.OleDb, as per Brendan Reynolds' post? (BTW his
code works fine for me).

> In Access (2003), I can create the relationship by opening
> Tools\Relationships and dragging one field on top of the other, but it fails
> if I try to execute the query from a SQL window.

To be able to execute the SQL in the Access UI, you need to be in 'ANSI
query mode':

http://office.microsoft.com/en-us/assistance/HP030704831033.aspx

.