On Update cascade

G

Guest

Hi everyone,

I want to define relation for my 2 tables using <<ON UPDATE CASCADE>>.
However, I get the syntaxe error <<Eror de syntaxe in the CONSTRAINT
clause>>.
SEction_detail is my foreign table and Section_id is my primary table. Here
is my code:

Dim db As Database

Set db = CurrentDb()
db.Execute "ALTER TABLE SELECTION_DETAIL ADD CONSTRAINT
SELECTIONID_SELECTIONDETAIL FOREIGN KEY (NO_SELECTION) REFERENCES
SELECTION_ID (NO_SELECTION) ON UPDATE CASCADE"
db.Close
Set db = Nothing
 
G

Guest

db.Execute("ALTER TABLE SELECTION_DETAIL ADD CONSTRAINT
SELECTIONID_SELECTIONDETAIL FOREIGN KEY (NO_SELECTION) REFERENCES
SELECTION_ID (NO_SELECTION) ON UPDATE CASCADE;")
 
G

Guest

Hi Klatuu

I try the statement that you quoted, it display the same erreur message.
However, If I remove the keyword <<ON UPDATE CASCADE>>, the command execute
successfully. Any idea will be appreciated. Thank

"Klatuu" a écrit :
 
G

Guest

I don't see the problem. That doesn't mean it's not there. Just for
testing, take off the ON UPDATE CASCADE and see what happens.
 
J

John Nurick

PMFJI - especially as this isn't an area I know much about: but I seem
to remember reading that ON UPDATE CASCADE and some other SQL features
in Jet 4 were available via ADODB but not via DAO. Perhaps try executing
the SQL statement against CurrentProject.Connection rather than
Current.DB?
 
G

Guest

Hi John

I try to use CurrentProject.Connection.Execute command, it work perfectely.
My next step is to use the same statement in C . It try to write the same
statement and it give me syntaxe error when <<ON CASCADE UPDATE>> is
present. Do you have any idea?? something relate to Microsoft Jet OLEDB 4.0?
What do I have to do for checking all of those?


"John Nurick" a écrit :
 
T

Tim Ferguson

I try to use CurrentProject.Connection.Execute command, it work
perfectely. My next step is to use the same statement in C .

You'll still have to use the ADODB library, not an older one. Try asking in
a Visual Studio group if you need to check out which C libraries come in
different environments.

Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top