Creating automatic records

?

*

I have a table that contains people's names. I also have a joined table
(1-to-1) that stores their settings. How do I make access automatically
create a record in the settings table, when I add a record to the people
table?
 
K

Ken Snell [MVP]

By having your form run an append query in the form's AfterUpdate event to
add a new record to that table for the person who was just added (you'd need
to set a flag for knowing when a person has been added, or test to see if a
record already exists in the table for the person who was just "edited" on
the form).
 
?

*

Ugh. How do I get started with something like that? I have never used any
of those tools before.
 
B

Barry-Jon

Hi,

Only because you mention you have not used any of "those tools" before
I am wondering if you have a compelling reason for having two seperate
tables related in a one-to-one manner. Why have you decided to use two
tables instead of one (where if a record exists in one table 1 and only
1 related record must also exist in the second table). Using one table
instead of a one-to-one relationship would negate the need to create
the additional records in the first place. I have found in databases I
have inherited that one-to-one relationships, if not implemented
carefully, leave the database wide open to poor referential integrity.

Barry-Jon
 
K

Ken Snell [MVP]

Barry-Jon's question is one that you should consider. If you still believe
that you need the second table, then read up on append queries in Help file.

You can use the form's AfterUpdate event to run a macro or VBA code that
will run a stored append query that will do what you seek. You can create
the append query and save it (for example, name it
"qry_Append_PeopleSettings"). This query can use a control on your form to
get the primary key value of the parent table, and then use that as the
value for the foreign key in the child table.

If you haven't already done so, I also recommend that you obtain a book on
ACCESS and become familiar with the basic information for queries, forms,
etc.

I am hesitant to post any more details, as I am not aware of your current
skill level and what I post may be unhelpful for you (either too basic or
too complex).
--

Ken Snell
<MS ACCESS MVP>
 
Top