Use autonum once allocated

livvie

Registered User.
Local time
Today, 13:11
Joined
May 7, 2004
Messages
158
I am adding reords to 2 tables via a form and subform. The id is an autonum on the main form and I want this to carry through to the subform but when I try this I get an error saying the Id field cannot be blank in the subform. How do I populate the id field in the subform with the autonum from the main form all in the one Add New method.
 
Rich said:
Link the Child/Master fields on the Property Sheet

Have done that for the subform.
 
I am using AddNew because the forms are based on a series of SQL queries not on a specific table.



Pat Hartman said:
I'm not sure why you would be using .AddNew to add rows to the subform's recordset. If the forms are bound, Access will add the rows automatically without any code.

If you find that you need to do this in code, you'll have to populate the foreign key yourself before you add the record.
 
Pat Hartman said:
Is the form's recordsource query not updatable for some reason?
I'm trying it now just using Access and I cannot get it to get the autonum from the parent. It worked earlier when I didn't want it to.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom