sql for insert into join tables (1 Viewer)

prodigy

Registered User.
Local time
Today, 02:50
Joined
Apr 22, 2005
Messages
66
Hi,
I have an unbound form that is based on a query. On the Load-event I have populated textboxes with the underlying records (it works fine).

The underlying query is based on 2 tables that are joined on (PrimaryKey) Table1.ID = Table2.ID (ForeignKey).

The Form has one Add-CmdButton. When the user will click the Add-button the content of the textbox will get added or saved in the underlying database.

I want to know the SQL to add, so that I can write the code behind on the Click-event of the button.

I know on how to add records with a single table (writing code behind), however, I want to know on how to do when it comes with joined tables (INSERT SQL statement ?).

Thanks and regards,
Prodigy.
 

ajetrumpet

Banned
Local time
Today, 04:50
Joined
Jun 22, 2007
Messages
5,638
Prodigy, a couple of things for you to consider...
I have an unbound form that is based on a query.
This is not possible.

BOUND FORM = Has Recordsource (usually clarified by someone saying "Form is based on a "query/tableName")
UNBOUND FORM = Has no Recordsource
The Form has one Add-CmdButton. When the user will click the Add-button the content of the textbox will get added or saved in the underlying database.
To a new Record? Or will it update the value of a current record's field with the textbox value?
I know on how to add records with a single table (writing code behind), however, I want to know on how to do when it comes with joined tables (INSERT SQL statement ?).
If you're talking about appending records, or partial records to a table that is PART of a join with another table, you can append the values into new records depending on the join, as it relates to the target table. Say, for example, it is a child table of its parent, it's not going to let you append, because a record will be needed in the parent table first.
 

Users who are viewing this thread

Top Bottom