Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Auto select time frame at startup

Hi,

I'm trying to fix that my QV application will select a specified timerange at startup. Or something alike that mightdo the trick.

Within the QVW i have a field that is a combination of the year and week and ta year field

INCENTYR & '-' & [INWK] AS YearWeek,
INCENTYR AS Year

The goal is that from the current year, all weeks till the current week are automaticaly selected at QVW startup.

What is the best way to fix this issue?

Regards

4 Replies
surender_mehta
Contributor II
Contributor II

Hi,

As i understand from your question...

If you are able to select the current year, the data corresponding to the same will reflect automatically, means the data for all the weeks of current will reflect.

Just right in actions

Select field Year

=Max(Year)..

Hope will help

Not applicable
Author

Hi,

I understand you. But the thing is, when I select the current year, it will light up all the weeks where data is available in this year.

But I only want the weeks light up till last week.

And this all automated when I start my QVW.

Regards.

Not applicable
Author

Here is some code that I use to select the previous 12 months of invoices by default which should give you some ideas:

' Set rolling 12 month period for invoice month/year

' Get beginning range month/year
FromDate=DateAdd("m",-12,Date)
FromY=Year(FromDate)
FromM=Month(FromDate)
if len(FromM) < 2 then FromM = "0" & FromM end if
RangeFrom=FromY & FromM

' Get to range month/year
ToDate=DateAdd("m",-1,Date)
ToY=Year(ToDate)
ToM=Month(ToDate)
if len(ToM) < 2 then ToM = "0" & ToM end if
RangeTo=ToY & ToM

ActiveDocument.Fields("mmm CCYY").Select ">=" & RangeFrom & "<=" & RangeTo

Regards,

Gordon

Not applicable
Author

Thanks for the code.

I'll will see what I can use from it. I think it's not exactly usefull for my problem when I intepret it the right way.

regards.