I have a forcast report that contains a sub report. The sub report has twelve calculate that data based on a query. The query retrieves value from a table and then via code the value is placed in the appropiate text box.
currently the code resides in the subreports "on load" event - works fine when I open the subreport by itself
Private Sub Report_load()
Dim sql1, sqmend, sqmonth As String
Dim JanHr As Long
Dim arrTotMonth(12)
Dim mymonth As Integer
Dim dbs As Database
Dim RS As DAO.Recordset
Dim rsq As DAO.Recordset
Set dbs = CurrentDb
sql1 = "SELECT [tblMonthly ForcastPrintTotals].[fPrintTot] FROM [tblMonthly ForcastPrintTotals]WHERE ((([tblMonthly ForcastPrintTotals].Fmonth)='"
sqmend = "'));"
For mymonth = 1 To 12
'Get the Hours per project
Set RS = dbs.OpenRecordset(sql1 & mymonth & sqmend)
arrTotMonth(mymonth) = RS!fPrintTot
Next
'Populate Report
txtJanTotHrs = arrTotMonth(1)
txtFebTotHrs = arrTotMonth(2)
txtMarTotHrs = arrTotMonth(3)
txtAprTotHrs = arrTotMonth(4)
txtMayTotHrs = arrTotMonth(5)
txtJunTotHrs = arrTotMonth(6)
txtJulTotHrs = arrTotMonth(7)
txtAugTotHrs = arrTotMonth(8)
txtSepTotHrs = arrTotMonth(9)
txtOctTotHrs = arrTotMonth(10)
txtNovTotHrs = arrTotMonth(11)
txtDecTotHrs = arrTotMonth(12)
'Calculate over short
'txtOvShJan = (txtAvailHrsJan - txtJanTotHrs) / 19
'Calculate projects per dat
' txtPojperDayJan = AccessTotalsJanuary / 19
End Sub
When I opent the main report all of the txt???totHrs controls are empty. I need to have all of the fiels show their data.
Can some one help me?
Thanks
Karen