Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form/Subform...filtering??

Status
Not open for further replies.

Gigi0614

Programmer
Jun 20, 2004
25
0
0
US
Hi!
I'm wondering how to make this work...

I've got a 1 to many relationship between two tables, and I'm trying to setup a subform. I've got a SURGERY table. There can be many PROCEDURES for each surgery. I've got a foriegn key into the procedures table.

HOW do you setup a subform that only pulls the procedure records related to that surgery? Is this a filter or something??
 
Gigi0614

Do you have your relations defined with the Relation. (When you are in the database window, select "Tools" -> "Relationships") When you define your relationships here, Access will attempt to create your linkage when creating queries and form / subform.

Open the form with the subform in design view. Make sure the properties window is opten ("View" -> "Properties")

Now, select a field in the main form, and then select the subform. Doing "it" this way, will allow you to see the properties for the form / subform, as opposed to seeing properties for specific fields.

On the property window, select the "data" tab. The fields you want to look at are "Link Child Fields" and "Link Master Fields". If your database design / schema is done properly, you should have the primary key or linked key in the "Master" field, and the same key as a foriegn key in the "Child" field.

With this setup, Access will automatically grab the detail items (procedures) for each surgery ... OR ... will insert the foreign key into the detail record when the detail record is creted.

Richard
 
Richard,
I redid the subform, and it's looking good!
Link Master Fields = surgeryID
Link Child Fields = surgeryID

So that part is right! The only thing I'm concerned about is the displaying of the subform fields. I've seen this in the ACCESS templates where subform fields were displayed in rows, and if you wanted to add another one, you just started typing on the next line.

Not sure exactly how to make my subform do that...But my subform displays the procedure records 1 by 1, and forces you to hit the arrow button to see the next one. I'd like to display all these procedures (in a subform) and allow them to add another one in a blank line. Does that make sense??

I think my keys & table structures are good. I'm just not sure how to format the subform.

Thanks!!
 
Weird...

Do you mean you are only seeing one record at a time?

Is your subform big enough ? Drag and expand the subform to allow use more "real estate".

Many of us use subforms, and depending on the design, you should see multiple records. The last record should be blank with an "*" which is where you enter new records.

You should also see the typical navigation arrows including the "->*
 
I see, I see!! That was the problem.

Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top