how to add new record with inner join

  • Thread starter Thread starter ljb
  • Start date Start date
L

ljb

I have a form that needs to add new records but it is based on a query with
an inner join. How do I enable edits in all of the fields? I can add/edit
the fields from one table but the other fields won't accept focus until the
record exists. In the BeforeInsert event I have code to set the keys
properly which immediately creates a record in both tables and allows edits.
But what do I do if the users cancels the edit?

thanks
Lawrence
 
Lawrence,

You might be better off creating two forms, one a subform of the other,
rather than basing your form on the inner join query.

The master form will have as its data source the first table, the sub form,
or child, will have as its data source the second table. Link the forms
with the common field.

This way you can add as many records in the first table, without needing to
have records in the second child table. You don't need special code to
create records in the tables.

Jack
 
Treebeard said:
Lawrence,

You might be better off creating two forms, one a subform of the other,
rather than basing your form on the inner join query.

The master form will have as its data source the first table, the sub form,
or child, will have as its data source the second table. Link the forms
with the common field.

This way you can add as many records in the first table, without needing to
have records in the second child table. You don't need special code to
create records in the tables.

Jack

I agree that will work. I was hoping for another work-around. I really
dislike creating an application that reveals the quirks of the underlying
data structure. I would prefer to redesign the database if I could since
after a new record is created there is always a one to one relationship in
both tables.

thanks
 
Back
Top