Quering A Subform

  • Thread starter Thread starter thegary
  • Start date Start date
T

thegary

I have a simple form with 2 drop downs (Name and Date). I want to display
data based on a selection of either one. I want it displayed in the subform.

I've been cruising the net look for examples of this.

I'm using 2007

thegary
 
Since you want to limit the subform based on what's in *either* control
(possibly but not necessarily both), you can't use the
LinkMasterFields/LinkChildFields.

Instead use the AfterUpdate event procedure of the controls to assign the
RecordSource (or Filter) of the subform. This means writing code to generate
the query statement that limits it to the relevant contents.

There's an example of generating such a filter here:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html

Hopefully your controls are really called Name and Date, because Access is
likely to misunderstand those names. For Date, it may think you mean today
(the system date), and for Name it may think you mean the name of the form
(instead of the contents of the Name control.) It would be better to avoid
those names, and also the ones in this list:
http://allenbrowne.com/AppIssueBadWord.html
 
Back
Top