I have a form that requires a start date and an end date as input for
the parameters then runs the form which open queries which are designed
to populate certain tables. As it stands now, i can only run the form
one month at a time, so i would enter the first of the month, say
01/01/2002 and the end of the month 01/31/2002 and it would run the
form with january data. If i enter a range of dates from say 01/01/2002
to 06/30/2002, it will only run the query based on the end date being
june 30th and it will ignore the start date. therefore the tables will
only be populated with june data, not january, february, etc. as
expressed by the parameters.
Therefore, what i need to do is create a loop function that will run
the form month by month until all the queries have been run and all the
tables have been populated. I have an idea how to do this, but i can't
seem to get the loop statement correct. it's still only running the
form for only one month based on the end date. is there anyone that can
point me in the right direction? thanks.
Here is pretty much the code that i have thus far:
Dim intDuration As Integer
Dim strInterval As String
intDuration = 1
strInterval = "m"
DoCmd.SetWarnin gs False
Do Until 'this is where i want it to loop the statements month by month
CalcCum "qryCalcCumYTDB M"
DoCmd.OpenQuery "qryYTDReturnsB M", acNormal, acEdit
CalcCum "qryCalcCum QBM"
DoCmd.OpenQuery "qryQReturnsBM" , acNormal, acEdit
CalcCum "qryCalcCum6mBM "
DoCmd.OpenQuery "qry6MReturnsBM ", acNormal, acEdit
CalcCum "qryCalcCum12mB M"
DoCmd.OpenQuery "qry12MReturnsB M", acNormal, acEdit
CalcCum "qryCalcCumCumB M"
DoCmd.OpenQuery "qryCumReturnsB M", acNormal, acEdit
CalcCum "qryCalcCum24mB M"
DoCmd.OpenQuery "qry24MReturnsB M", acNormal, acEdit
Loop
MsgBox "All Calculations Completed"
the parameters then runs the form which open queries which are designed
to populate certain tables. As it stands now, i can only run the form
one month at a time, so i would enter the first of the month, say
01/01/2002 and the end of the month 01/31/2002 and it would run the
form with january data. If i enter a range of dates from say 01/01/2002
to 06/30/2002, it will only run the query based on the end date being
june 30th and it will ignore the start date. therefore the tables will
only be populated with june data, not january, february, etc. as
expressed by the parameters.
Therefore, what i need to do is create a loop function that will run
the form month by month until all the queries have been run and all the
tables have been populated. I have an idea how to do this, but i can't
seem to get the loop statement correct. it's still only running the
form for only one month based on the end date. is there anyone that can
point me in the right direction? thanks.
Here is pretty much the code that i have thus far:
Dim intDuration As Integer
Dim strInterval As String
intDuration = 1
strInterval = "m"
DoCmd.SetWarnin gs False
Do Until 'this is where i want it to loop the statements month by month
CalcCum "qryCalcCumYTDB M"
DoCmd.OpenQuery "qryYTDReturnsB M", acNormal, acEdit
CalcCum "qryCalcCum QBM"
DoCmd.OpenQuery "qryQReturnsBM" , acNormal, acEdit
CalcCum "qryCalcCum6mBM "
DoCmd.OpenQuery "qry6MReturnsBM ", acNormal, acEdit
CalcCum "qryCalcCum12mB M"
DoCmd.OpenQuery "qry12MReturnsB M", acNormal, acEdit
CalcCum "qryCalcCumCumB M"
DoCmd.OpenQuery "qryCumReturnsB M", acNormal, acEdit
CalcCum "qryCalcCum24mB M"
DoCmd.OpenQuery "qry24MReturnsB M", acNormal, acEdit
Loop
MsgBox "All Calculations Completed"
Comment