Click to See Complete Forum and Search --> : Cannot add or change a record because a related record is required in table


Illufox
05-05-2005, 05:56 PM
I have set up a small record insertion form which can be used to add database users. I remember that I was able to add a record before I made some design changes. But ever since I'm getting the following error when I submit the form:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] You cannot add or change a record because a related record is required in table 'DbUser'.
/spaces/events/add_dbuser.asp, line 157

I have double and triple checked my code and can't find out what's wrong. I have even compared the code to another form that works just fine and can't find any differences. Line 157 is not really the error itself, it's just the "execute" command which doesn't really help a lot finding the problem.... :(

I'm at a loss here, so any help is greatly appreciated....

buntine
05-05-2005, 07:36 PM
Its because the table has check constraints. MS Access will not allow you to insert an unrelated record in this table without first inserting one in the dbUser table. Otherwise, referential integrity will be broken.

See the design of your database.

Regards.

phpnovice
05-05-2005, 07:47 PM
Predefined Access table interrelationships don't work in an Internet client-server environment. Delete those and you should have better results. Of course, then you must manage the referential integrity yourself. ;)

Illufox
05-05-2005, 08:11 PM
I thought so, just wonder why it worked earlier.....thanks :)