Eileen Murphy
asked on
ODBC Calls Faile
I am sure this is an obvious one, but for some reason everything I try is not working.
I have an Access front-end with a SQL back-end connected via ODBC.
I have a form with multiple sub-forms.
When I add a new parent record one of the related tables throws:
ODBC--call failed. Cannot insert the value NULL into column 'link to parent' column does not allow nulls. Insert fails. (#515) The statement has been terminated. (#3621)
The parent table has a RecordID (PK, int, not null) as a key. The related table (bound to the subform) has a RecordIDLink (PK, FK, int, not null)
I had what I thought were correct database diagrams where I set it for Cascading events, etc.
When this error started popping up I deleted the diagrams and reconnected to the linked tables. I even tried to use an append query to add the related record as soon as I go to a new record and that is still throwing the error.
Please help!!!
Thanks Experts.
I have an Access front-end with a SQL back-end connected via ODBC.
I have a form with multiple sub-forms.
When I add a new parent record one of the related tables throws:
ODBC--call failed. Cannot insert the value NULL into column 'link to parent' column does not allow nulls. Insert fails. (#515) The statement has been terminated. (#3621)
The parent table has a RecordID (PK, int, not null) as a key. The related table (bound to the subform) has a RecordIDLink (PK, FK, int, not null)
I had what I thought were correct database diagrams where I set it for Cascading events, etc.
When this error started popping up I deleted the diagrams and reconnected to the linked tables. I even tried to use an append query to add the related record as soon as I go to a new record and that is still throwing the error.
Please help!!!
Thanks Experts.
ASKER
Hi thank you for responding. I actually know which sub-form is the culprit and which table is causing this. I link the subform to the main form with the field in question which means it should automatically be populating that field based on the value on the parent form. It almost seems that despite the fact that when I add a new record and force a save so the autonumber is generated that the related table represented by this particular subform is being updated before the autonumber exists. Does that seem possible??
Autonumber is used in main table, other related tables should use a number field, not Autonumber to link with parent tables field..
ASKER
That's exactly right. The related table has a numeric field linked to the parent autonum.
Fine.
Compare between the problem table and other working one.
If you can, try to help me in reproducing the issue.
Compare between the problem table and other working one.
If you can, try to help me in reproducing the issue.
ASKER
There are 6 subforms on the main form -- all related by a numeric field linked to the parent autonum field.
When I click Add new on the parent form I go to a new record, force a save to generate the autonum (which is displayed on the form so I can watch when it gets generated) and before it displays I get the OBDC error -- which tells me that somehow the subform is adding the record before the parent record is saved.
That is the issue. Not sure what else you need in order to assist me. I can't backup the SQL tables because the data is proprietary and stored on my client's server.
When I click Add new on the parent form I go to a new record, force a save to generate the autonum (which is displayed on the form so I can watch when it gets generated) and before it displays I get the OBDC error -- which tells me that somehow the subform is adding the record before the parent record is saved.
That is the issue. Not sure what else you need in order to assist me. I can't backup the SQL tables because the data is proprietary and stored on my client's server.
Since you know the issue, I expect you to recreate it using dummy tables reflecting the structure of the original tables populated with dummy info.
Doing that might lead you to the solution.
Doing that might lead you to the solution.
ASKER
I see. If I were to do that using Access tables I will not get the ODBC errors. Maybe someone else has had this problem in the past who can help me. Thanks a lot.
"I see. If I were to do that using Access tables I will not get the ODBC errors"
I mean to do that using the same environment.
"Thanks a lot."
Welcome!
I mean to do that using the same environment.
"Thanks a lot."
Welcome!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm an idiot! On the subform I recently did make a change to force a save because that subform has a subform on it as well.... Geez.... no wonder it just started happening. I had completely forgotten about that.
Thanks LSM!!!
Thanks LSM!!!
Then add one sub form at a time and try.
If you can send sql to create the tables, then upload the access database sample.