Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

when report opens textbox is to equal . . .

Status
Not open for further replies.

webfaktor

Technical User
May 22, 2001
22
0
0
Hi,

WHen opening a report can you direct the control source of an unbound textbox to perform different functions, i.e.,

DoCmd.OpenReport "ReportName", acViewPreview
Reports![ReportName]![UnboundTextboxName] = "A"

I ask this because my report and its query are multifunctional and thus I would like to have a text box that I could direct (as I requested above) to reflect precisely what information the report is providing.

Advance thanks,

Web
 
I have found a solution. Because in one instance only 1 record would be reported and in the other multiple records would be reported, I used the DCount code seen below to make visible the appropriate text box header. I am sure there's a better solution - but if it works. . . What the hay!

Private Sub Report_Open(Cancel As Integer)
If DCount("*", "[QueryNameA]") > 1 Then
Me.UnboundTextBoxA.Visible = True

ElseIf DCount("*", "[QueryNameA]") = 1 Then
Me.UnboundTextBoxB.Visible = True
End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top