Setting up subform

G

google3luo359

Hi Folks could use some help here if possible.

Just creating a form with a subform.
I'd like to pull up records into the form via two linked tables
(tables linked by StudentNum)

There are so many ways to get this mucked up though:

1. Record source for each form?
2. Source object of the subform?
3. Linked child field?
4. Linked master field?

I have a field on a password form that I'd like to use as the basis for
pulling up records on the main form (the form with the subform). The
idea is to pass the StudentNum from the password form onto the main
form and thereby have the Student record pulled up.

I thought I had it working for a bit then I realised it wasn't
happening.
Any suggestions on what to look out for or do next would be
appreciated.

Thanks,

Ric
 
T

tina

the main form is bound to the "parent" table in relationship between the two
tables. the subform is bound to the child table in that same relationship.
the LinkedMasterFields property is set to the name of the primary key field
of the parent table; the LinkedChildFields property is set to the
corresponding foreign key field of the child table. to open the main form
with only the selected student's record, use the WHERE clause argument of
the OpenForm method, in a macro or VBA.

hth
 
G

google3luo359

Thanks Tina that was a help.

I managed to get the form working again late last night.
I believe I now understand the main concept behind the form/subform and
the underlying tables.

I now have it set up the way I orignally did, with a form and its two
subforms.
The first subform is based on a query of table one. The second subform
is based on a query of table two. The two tables are linked by their
primary keys.

What I had done initially was delete the first subform from the main
form because visually I didn't like all of the frames on the form. It
was too busy.
I figured I could just add the fields I had deleted to the second
subform.
At first it seemed to be working, but then I realised that I was only
pulling up the records from the second subform and not from the main
table.

So I've gone back to two subforms on the main form. One thing that's
good about this is that I can clearly see the relationship between the
tables and the subforms working. The first subform is a window on the
first table and the second subform is a window on the second table.

Ric
 

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