Create an expanding subform

Trystyn

Registered User.
Local time
Today, 20:39
Joined
Jul 30, 2010
Messages
26
Hi,

I am trying to create a database showing a history of my personal travel which expands as the years progress.

As such, I have a main form which scrolls through the field [CurrentYear].

I have a table which links the countries [Country] I've visited to the years [Year] I went, and a query of this table which looks for the Minumum year [MinOfYear] (i.e. the first year I visited the country)

In the main form, I can link [CurrentYear] to [MinOfYear] in the subform to see which countries I visited on any given year but what I would like to achieve in my main form, is an accumulative effect so that for each successive year, I don't just see the countries visited in that year, but which expands to show an accumulation of all countries visited by the current year.

I have managed to create an unbound field in the subform which displays a value of 1 if [CurrentYear] <= [MinOfYear] otherwise a value of 0 so it is dynamic and changes as I scroll through [CurrentYear] for each country, however, I cannot use this field as the child link, nor apply a filter to it, either of which would have solved the problem I think so I'm not sure what other approach to take.

All suggestions gratefully received.

Tryst
 
Given this some more thought and I am maybe making a mountain out of a molehill.

I think what I need to do is apply a filter to [MinOfYear] in the subform where it has a value <= [CurrentYear] in the main form. Hopefully this is possible with some code in VBA?

Thanks
 
Resolved

Me.SubformCountry.Form.Filter = "[MinOfYear]<= " & Chr(34) & Forms![Countries by Year].[Year] & Chr(34)
Me.[SubformCountry].Form.FilterOn = True
 

Users who are viewing this thread

Back
Top Bottom