J
JimS
I have a query that brings together data from 12 queries into a "shadow" flat
table to reduce form load times for certain forms. Recently, it's begun
running out of system resources. I think it's because all 12 queries (and
some of the subqueries...) call an Access (2007) user function I wrote:
______________________________
Public Function WeekNumber(ArgumentDate As Date, Optional WeekEndDate As
Date = #12/30/2000#) As Long
' Company's default week end day of week is Saturday, hence the default
12/30/00, which was a Saturday
' NOTE: This will not work well with dates prior to 12/30/00! Don't use
it!
' Modified 4/28/09 to correct wrong results for Saturday Argument Dates
WeekNumber = CLng((ArgumentDate - 1 - WeekEndDate) \ 7)
End Function
__________________________________
Anyway, I would guess I need to somehow stop all these myriad queries and
subqueries from calling this routine literally 300,000 times or more each
time I run this shadow-table create query.
What's the best way to do this?
I could create a reference table that has two columns: ReferenceDate,
WeekNbr
If I did that, could I join columns that are dates which may have
fractional (time) components? How do I do that? Do I trim the time first? How?
I could go back to the queries and replace many of those references with
the formula shown in the function above... I think I've done that in some
cases...
Of course, I'm not asking the fundamental question: Is there something
else that could be causing a query to run out of system resources (after
running for 45 minutes?)
Thanks for your advice!
table to reduce form load times for certain forms. Recently, it's begun
running out of system resources. I think it's because all 12 queries (and
some of the subqueries...) call an Access (2007) user function I wrote:
______________________________
Public Function WeekNumber(ArgumentDate As Date, Optional WeekEndDate As
Date = #12/30/2000#) As Long
' Company's default week end day of week is Saturday, hence the default
12/30/00, which was a Saturday
' NOTE: This will not work well with dates prior to 12/30/00! Don't use
it!
' Modified 4/28/09 to correct wrong results for Saturday Argument Dates
WeekNumber = CLng((ArgumentDate - 1 - WeekEndDate) \ 7)
End Function
__________________________________
Anyway, I would guess I need to somehow stop all these myriad queries and
subqueries from calling this routine literally 300,000 times or more each
time I run this shadow-table create query.
What's the best way to do this?
I could create a reference table that has two columns: ReferenceDate,
WeekNbr
If I did that, could I join columns that are dates which may have
fractional (time) components? How do I do that? Do I trim the time first? How?
I could go back to the queries and replace many of those references with
the formula shown in the function above... I think I've done that in some
cases...
Of course, I'm not asking the fundamental question: Is there something
else that could be causing a query to run out of system resources (after
running for 45 minutes?)
Thanks for your advice!