I want to add records to a table from a form that will have multi.

J

Joyce

I am trying to create a form that will add multiple records at one time. It
is like a one to many relationship. Here is what I need help with...I want
to be able to add a person (client id) and all the groups that he/she is
taking. One client id can participate in multiple groups (like taking many
classes at one time). When all the groups are selected for this one person,
add all the groups for this one person to the table. How do I go about
creating this form and adding in the records?
 
T

tina

first, you need correct table(s) structure. based on the info you posted,
probably:

tblClients
ClientID (primary key)
FirstName
LastName
(other fields the describe a client)

tblGroups
GroupID (primary key)
GroupName
(any other fields that describe a group)

tblClients and tblGroups have a many-to-many relationship. this is resolved
by creating a third table that is the "many" side of a one-to-many
relationship with the first two tables.

tblClientGroups
ClientID (foreign key from tblClients)
GroupID (foreign key from tblGroups)
you can use both these fields to create a combination primary key, or you
can create a third field - probably an Autonumber - to use as the primary
key.

set the relationships between the three tables in the Relationships window.
now it's easy to express the relationships by creating a main form based on
tblClients, adding a subform based on tblClientGroups, and creating a combo
box in the subform with a RowSource (*not* ControlSource) based on
tblGroups. when you enter a new client record in the main form, or move to
an existing record, you can add multiple records in the subform - one record
for each group that the client is taking.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top