views:

29

answers:

1

I have a form in Access 2003 that contains 2 subforms. The first is in datasheet view and is only 2 fields, SiteID and SiteName, so a list of many sites for one record in the parent form. The second subform is the same datasource as the first, but in single form view, so it shows all the site fields for one site in a single form. The idea being that I have a list of the site names on the left and I want to then click on one and have its OnCurrent event filter the subform on the right to show all the fields in that record (for that site).

This seems like a fairly simple thing to do but I can't figure out what code (docmd.gotorecord?, filter?, programatically change the subforms query and then requery etc) is the best to use... and how to make it actually work.

Any help appreciated.

A: 

Have a look at the Customer Orders form in the Northwind sample database (NWind.mdb) that ships with every version of Access or can be downloaded http://www.microsoft.com/downloads/details.aspx?familyid=c6661372-8dbe-422b-8676-c632d66c529c&displaylang=en

I think you will find it does what you want.

Remou
Yes, bang on, thanks Remou. I hate the way I put something down for a year and when I pick it up again I'm back to square one.
Glenn M
Link Master and Link Child fields in Data Tab do the trick.Link master = [form_name]!Form.[field_name]Link child = [field_name]
Glenn M
This is one of the clever things about the link fields, i.e., that they can be any valid expression, including a field on another subform. It's a very powerful feature.
David-W-Fenton