H
hangbill
Guest
Greetings
Have not found too much written on error 2191.
Using Access 2003
Have a subreport, based on a crosstab. Some of the controls on the report are unbound and they get their values from an On Open event.
This works fine when I open the subreport on its own. But when I try open the main report, which contains the subreport, get an error 2191 ie "you cant set the control source property in print preview or after printing has started".
The code is
Private Sub Report_Open(Cancel As Integer)
Dim IntI As Integer
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("select * from QryRxAudit")
rs.MoveLast
rs.MoveFirst
For IntI = 1 To rs.RecordCount
Me("Col" & IntI).ControlSource = rs("RxAuditID")
Me("TotalCol" & IntI).ControlSource = "=Sum([" & rs("RxAuditID") & "])" & "/" & ("SumTotalOfNumberAuditID")
rs.MoveNext
Next IntI
End Sub
Have tried changing the event, for example to OnActivate, but no-go
Thank you.
Have not found too much written on error 2191.
Using Access 2003
Have a subreport, based on a crosstab. Some of the controls on the report are unbound and they get their values from an On Open event.
This works fine when I open the subreport on its own. But when I try open the main report, which contains the subreport, get an error 2191 ie "you cant set the control source property in print preview or after printing has started".
The code is
Private Sub Report_Open(Cancel As Integer)
Dim IntI As Integer
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("select * from QryRxAudit")
rs.MoveLast
rs.MoveFirst
For IntI = 1 To rs.RecordCount
Me("Col" & IntI).ControlSource = rs("RxAuditID")
Me("TotalCol" & IntI).ControlSource = "=Sum([" & rs("RxAuditID") & "])" & "/" & ("SumTotalOfNumberAuditID")
rs.MoveNext
Next IntI
End Sub
Have tried changing the event, for example to OnActivate, but no-go
Thank you.