John C
John C

Reputation: 97

Return subform values based on muliple criteria in Access

I need to select one or more values from the same field in subform 1 and display the applicable values in subform 2.

I have done this kind of thing by selecting criteria from multiple fields but not with multiple line-item values from the same field. My first thought was to build a dynamic SQL string to populate subform 2 but just wondering if there is an easier way to do this.

enter image description here

At the moment if I select a line-item in subform 1 (flight itinerary), subform 2 will only show the applicable flight segments for that itinerary. If a customer has more that one flight itinerary for the same trip in subform 1 I need to show all flight segments for the entire trip in subform 2.

Upvotes: 0

Views: 138

Answers (1)

John C
John C

Reputation: 97

Thanks to Lee Mac's suggestion to utilize the IN() function/operator, I was able to feed the IN() function with a subquery string to return the data I need without having to loop through a recordset. Just had to ensure that the subquery only returned values for a single field (in this case the ID field) or it would error out.

I created a function to fill in the Segment numbers in order.

Upvotes: 0

Related Questions