How do I assign an unbound object in a report?

S

S Jackson

I have a dialog form that users use to select to view and/or print different
reports.

One of the reports contains an unbound subreport. I am attempting to assign
the unbound object to a specific subreport using the following code behind
the "On Open" event of the Report:

Dim strReport As String

Select Case Nz(Me.Program, "")
Case "CNA", "NFA", "CMA"
strReport = "rsubCaseInfoSheet2"
Case Else
strReport = "rsubCaseInfoSheet"
End Select
Me.rsubReport.SourceObject = strReport

I get the message that I have entered an expression that has no value.

When I place the code behind the On Format of the Report Detail section I
get the error that reads: "You can't set the Source Object property after
printing has started."

I even tried placing this code behind the Repirt Header section, but get the
same message as above.

Here is a look at the query behind the report (if it helps at all):

SELECT tblCaseInfo.*, tblStatus.StatusRptNotes, tblStatus.TickleDate,
tblStatus.ClosedDate, tblHearings.HrgStart, tblRepresentatives.*,
tblAction.*
FROM (((tblRepresentatives RIGHT JOIN tblCaseInfo ON tblRepresentatives.ID =
tblCaseInfo.RepID) LEFT JOIN tblHearings ON tblCaseInfo.CaseId =
tblHearings.CaseId) LEFT JOIN tblStatus ON tblCaseInfo.CaseId =
tblStatus.CaseId) INNER JOIN tblAction ON tblCaseInfo.CaseId =
tblAction.CaseID
WHERE (((tblStatus.ClosedDate) Is Null));


Anyone have any thoughts?
 
M

Marshall Barton

S said:
I have a dialog form that users use to select to view and/or print different
reports.

One of the reports contains an unbound subreport. I am attempting to assign
the unbound object to a specific subreport using the following code behind
the "On Open" event of the Report:

Dim strReport As String

Select Case Nz(Me.Program, "")
Case "CNA", "NFA", "CMA"
strReport = "rsubCaseInfoSheet2"
Case Else
strReport = "rsubCaseInfoSheet"
End Select
Me.rsubReport.SourceObject = strReport

I get the message that I have entered an expression that has no value.

When I place the code behind the On Format of the Report Detail section I
get the error that reads: "You can't set the Source Object property after
printing has started."

I even tried placing this code behind the Repirt Header section, but get the
same message as above.


Because of the latter message, you can not set the
SourceObject property anywhere except the main report's Open
event.

I think you issue might be that the Open event is too soon
to check the value of a control (i.e. the first error is
coming from the Select Case statement). Is there some other
place you can get that value?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top