We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Private Sub Report_Open(Cancel As Integer) Dim rst As DAO.Recordset Dim iCount As Integer Dim fld As Field On Error GoTo Err_ErrorTag iCount = 1 Set rst = CurrentDb.OpenRecordset("qryTimesheet_GroupByEmployee_ThenActivity") For Each fld In rst.Fields '// These are the Rows. We want to start with the Column Headers. If fld.Name <> "Employee" And fld.Name <> "Employee_EmpID" And fld.Name <> "TotalOfTimeTotal" Then Me.Controls("txt" & iCount).ControlSource = "=([" & fld.Name & "]/[TotalOfTimeTotal])*100" Me.Controls("lbl" & iCount).Caption = fld.Name iCount = iCount + 1 '// This was added because only 30 controls fit on the report. However there are more columns being left out. If iCount > 30 Then Exit For '// Exit For Next End If End If Next '// This hides the controls if there are less then 30. Do Until iCount > 30 Me.Controls("txt" & iCount).Visible = False Me.Controls("lbl" & iCount).Visible = False Me.Controls("lbl" * iCount & "a").Visible = False Me.Controls("line" & iCount).Visible = False iCount = iCount + 1 Loop Exit_ErrorTag: On Error Resume Next Exit Sub Err_ErrorTag: MsgBox Err.Description & vbCrLf & vbCrLf & " Error #: " & Err.Number & vbCrLf & "Error Line: " & Erl & vbCrLf & "Procedure: Report_Open " & vbCrLf & " Location: Report_rptTimesheet_EmployeeActivity_EmployeTotals", vbExclamation, "Error" Resume Exit_ErrorTag End Sub
Join the community of 500,000 technology professionals and ask your questions.