Hi all
I hope some one copld help me with this.
I have a datareport works fine as it is
I have a report textbox txtsex
I have 2 labels Pregnancy and Children
If txtsex is Male the 2 labels captions should be ""
My present code below gives me the object does not support this property or method Error

Private Sub DataReport_Initialize()
If DataReport11.Sections("Section1").Controls.Item("txtsex") = "Male" Then

DataReport11.Sections("Section1").Controls("Label60").Caption = ""
End If
End Sub

I nave been at it for two weeks without any success.
I wish some one could enlighten me.
I am from the land of Olympic gold medallist in 400 meters and I am proud
Thanks

I have eventually solved this problem.
I was trying to manipulate within data report and failed.
The data report is based on a form.
I referenced the form control in Data report for the if...Then as follows....

Private Sub DataReport_Initialize()
If frmReferral.txtFields(49).Text = "Male" Then
DataReport11.Sections("Section1").Controls("Label60").Caption = ""
DataReport11.Sections("Section1").Controls("Label61").Caption = ""
End If
End Sub

It works perfectly
Thanks every one

commented: Nicely done on solving your own problem. Also well done to Bolt, what an athlete!! Also, please mark as solved, thanx +0

Nicely done on solving your own problem. Also well done to Bolt, what an athlete!! Also, please mark as solved, thanx

Hi Senior Poster AndreRet
Thanks for the compliment. We are proud of all the Caribbean athlets who took part in the 2012 0lympics and all those medallists. I am from the land of Kirani James who won a Gold medal ever for Grenada

It's a pleasure. Well done to the guys, they have a strong team. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.