The Actor table stores actor names and maybe other information about the
actors. The Title table stores the movie's title and other specific
information such as year, director, and so forth. Each movie has many
actors, and each actor may be in many movies (a many-to-many relationship),
so the junction table is for TitleActor.
The movie's title would be a poor choice for primary key in the Title table
since many films have been remade.
You could make a compound primary key out of FirstName and LastName and hope
it is enough, but some actors are known by three names or with an initial
(Michael J. Fox, for instance), so you would have to hope there is no actor
named Michael Fox.
What problems will arise by the use of autonumber primary key in the Actor
table?
I decribed a form/subform structure for your database. I would use a combo
box for the actor names, as I described, but you can type them in if you
insist. You could run into problems if you make a typing mistake, and it is
more work, but that is up to you. In any case, if the main form is based on
Title and the subform is based on TitleActor, your best choice is probably
to open an Actor form (or use an input box, maybe) to add the name to the
Actor table. You can use code to copy the new name to the subform, if you
like.
You can use code to check the name against the Actor table, and to generate
a message if the name does not appear there. It may be something like this
in the text box After Update event:
If DCount("[FirstName] + [LastName]", "[tblActor]", "[FirstName] = """ &
Me.FirstName & _
""" AND [LastName] = """ & Me.LastName & """") > 0 Then
MsgBox "Name already exists"
Me.Undo
Cancel = True
End If
You would probably need to use FirstName, MiddleName, LastName, Suffix to
guarantee a unique name, so the code would be more complex than I have
described. Also, you should create a unique index for the combination of
fields. Then maybe you could use an append query to add a new record to the
actor table and to the ActorTitle table. I'm not sure how to go about that,
but a Google groups search for something like:
Append record VBA
should give you some ideas.
If you make a mistake when typing the name you will add a new record, so
that Michael J. Fox and Michael J Fox are two different people as far as the
Actor table is concerned.
Or you could use a combo box Not In List event to open the Actor form. Add
a new record, refresh the combo box row source when you close the Actor
table, and select the new name from the combo box.
> all what you said ture the sentence that you didnt understand i mean if
> the
[quoted text clipped - 116 lines]
>> key
>> in the junction table, you are storing the actor name.