Main form creates new record; subform doesn’t (1 Viewer)

hilian

Episodic User
Local time
Today, 01:14
Joined
May 17, 2012
Messages
130
I have two tables with a one-to-one relationship. I’m using a form and subform to allow the user to enter data. When I test it by adding data in the text boxes on the main and sub forms, I find that a new record is added to the table bound to the main form, but not to the one bound to the subform.

The form and the subform are linked on primary key/foreign key; the primary key for the main form is autonumber, and text boxes on the main form and the subform are bound to fields on their respective tables. On the main form, Allow Additions and Allow Deletions are set to Yes. The Record Type is Dynaset. These properties are the same for the subform. On the subform, the Enabled property is set to Yes, and the Locked Property is No.

What am I missing?

thanks,

Henry
 

hilian

Episodic User
Local time
Today, 01:14
Joined
May 17, 2012
Messages
130
I'd be curious to see what went wrong, but I decided to try it a different way. I set up a query uniting the two tables and used that query as the record source for a single form. I was able to add records to both tables, and the problem is solved.

Thanks to anybody who considered answering,

Henry
 

datap

New member
Local time
Today, 01:14
Joined
Jan 8, 2013
Messages
1
@hilian, could you provide more explanation about your query uniting the two tables, please !
 

hilian

Episodic User
Local time
Today, 01:14
Joined
May 17, 2012
Messages
130
datap,
Sorry for taking so long to get back to you. I didn't check my e-mail for a week.

It was very simple. I opened a new query in design view and added the fields I needed from both tables, which are related. Then I created a new form bound to the query with the fields from the query.
 

Users who are viewing this thread

Top Bottom