PDA

View Full Version : Solved: Access Reports (Its me again)



ukemike
04-14-2005, 12:49 PM
Hey guys.
Its me again. I just need to finish this project asap and keep stumbling on weird problems. I think this my last question.
When im generating a report, i know the event Detail_Format gets fired after every record.
I have in my report a label and a bound textbox.
The label says "Cell phone"
The textbox is bound to a cell phone field.

I need to implement a mechanism in Detail_Format that will, for every record, check if there is a phone number if the Cell phone field in the database, and if there is no cell phone number i need to hide the "Cell phone" label. This has to be done on every record. So basically, it would display:

Cell phone
(999)999-9999

if there was a cell phone in the database for this record and would display nothing if there wasnt.
I know you cant change the text of labels on reports, you can only change what they are bound to, when the report is loading. Its not like with forms.
I think i need to use an IIF statement on that field, but yet again Im stuck because you cant change the text.

Could anyone point me in the right direction ?

Thank you
Mike

smozgur
04-15-2005, 04:26 AM
Hi Mike,

Say your cell phone field name is "cellPhone".

Convert the "Cell Phone" label to Text (right click on label and Change to->Textbox) and set its Control Source by using following function:

=IIf([cellPhone]="","","Cell Phone")

This way, it will work by records and show empty string if cellPhone is empty.

I hope it helps.
Suat

ukemike
04-15-2005, 07:48 AM
Awesome. Works like magic.


Thanx

smozgur
04-15-2005, 07:56 AM
Glad to hear it helps!
Suat