Sub Form Help

F

ftbadolato

OK, I am brand new to Access, but it seems to be the best place to do
what I want to do.

I have a form that is tied to a Customer table. It is very simple,
just a table of customer information. I have another table in the
database that maintains my contact history information (i.e. when I
contacted the customer, how I contacted them, etc.). I inserted a
subform on the main form for this contact history table. How do I set
it up so that when I step through the customer records the subform
automatically changes to the contact history for whichever customer
record I am on. Of course, I want to be able to add history as well.

Not sure if this requires much more work, but one of the fields on the
subform is a ContactType combofield. It containts data from a table
like Phone, E-mail, Snail Mail, etc. The correct type needs to be
selected as I step through the main form and sub form.

Thanks in advance!
 
G

Guest

1 - Make sure that a key field is created in the Contacts table that matches
the key field in the Customers table

2 - Make sure the Wizards button is selected in the Toolbox

3 - Add a subform to the main form. The wizard will ask you what the "link
field(s)" are supposed to be. You can then use those two key fields.

4 - Use and enjoy.
 
G

Guest

You need a Primary Key field on your Customers table e.g. CustomerID
You also need a Foreign Key field on your ContactHistory table e.g. CustomerID

The first should be an Autonumber field, the second should be a Number field
set to Long Integer. These fields should be available (but not visible) in
each form respectively...

Now, in your subform control, select Properties/Data and set the 'Link Child
Fields' and 'Link Master Fields' both to CustomerID.

You now have a link! When you select a customer record, your subform will
show subrecords for that customer.

Steve
 
F

ftbadolato

There is a FK in the Customer table that is connected to the PK in the
ContactHistory table.

Wizards button?

The sub form is already there. Is there a way I can establish "link
field(s)" after the fact?
 
F

ftbadolato

OK, so it appears that there is a way to create links after the fact.
I selected my sub form, but in the Properties/Data table there is
nothing that says "Link...." This is Access 2003, does that matter?
 
G

Guest

Sure, using the Properties box for the Main form where you inserted your
subform. (Click the EXACT upper left corner of the subform, then select
PROPERTIES. But it's really a PITA. Since you already have the subform
created, it's MUCH faster just to CUT the current one, check the Wizard
control, and do a re-add of the subform to the mainform. Trust me, it's a
BUNCH faster.

;^)
 
G

Guest

You need to select the subform control in your main form. So, open the main
form in design view, select the subform control and check Properties/Data and
set the Link fields as I suggested...

From what I have read from your other posts, it seems you have your PK and
FK the wrong way round. PK's form the 'one' side of a relationship, FK's form
the 'many' side.

In the example you gave, it seems that one customer could have many records
in ContactHistory - therefore Customer is PK, History is FK...

Steve
 
F

ftbadolato

Anyone still there?

For some reason I cannot find any of this. When I right-click on the
upper-left corner of the subform and select Poperties/Data, here are
the options that I have:

Record Source
Filter
Order By
Allow Filters
Allow Edits
Allow Deletions
Allow Additions
Data Entry
Recordset Type
Record Locks
Fetch Defaults
 

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