PDA

Click to See Complete Forum and Search --> : Updating more than one table (with Access)


JPRoy392
Aug 9th, 2000, 03:51 PM
I am pretty new to VB, so please excuse the how elementery
this question may be.

I am trying to update a database that from a FORM in VB.
Some of the fields (textboxes in VB) are linked to certain
tables, others to other tables using the Datafield Property. I am updating through and ADO Data
Control using Jet 4.0.

I am trying to update a table called 'ORDERS' that has a
link to the 'CUSTOMER' table. When I use "enforce
referential intergrity" in Access, it bombs. The error
that I get is:

Run-Time Error: '-2147467259(80004005)':
You cannot add or change a record because a relaed record
is required in 'CUSTOMER'.

I am not updating the Customer table. When I remove the
referential intergrity, it works, but the related fields
remain null.

Thank you for any help.

JHausmann
Aug 9th, 2000, 04:46 PM
How much do you know about referential integrity?

Your database is set up so that it requires a CUSTOMER record for every Order record entered. You have 2 choices, you can either remove referential integrity or you can check to see if the customer in your order rec exists and add one if it does not (you could set up a "default" customer that isn't a real customer and use that _or_ ask the user to provide customer data when it's found to be missing).

[Edited by JHausmann on 08-09-2000 at 05:53 PM]