Accessing controls in a report via VB

Simmo2010

Registered User.
Local time
Yesterday, 22:37
Joined
Nov 28, 2007
Messages
18
I have a yes/no field (tick box) on my report but basically I want this displayed as a Y or N. I wanted to add a label, hide the original field and on report open test if the field is yes or no and then update the label accordingly....

I dont know if this is the best way but any help would be very much appreciated!
 
Add a TEXT box, not a label and then in the text box's control source use:

=IIf([YourYNFieldNameHere]= 0, "N", "Y")
 
Nice one! Stupid that I didnt think of that but has been a long day! ;) Many Thanks!
 
No problem, and don't worry about it - wasn't stupid question. We (and I lump myself in there too) don't always think of the obvious answer (or we don't know the obvious answer). :)
 
If there is an obvious way of doing something you can bet that it won't occur to me until after I've written 15,000 lines of VB, several queries, a couple of tables and couple of stored procedure calls just to be smart :(
 
tehNellie,

You should be glad because you have a good company; namely, me.

I've made a class module for something that could have been executed using a obscure method. :o
 
And I created a function to reverse the letters in a string, only to have it pointed out to me that it already exsisted within all versions after 97. :D

And that was only 4 months ago (and posted to the Code Repository then) :(
 
Ooo, yeah I remember that thread. I felt bad for you when you found that out.

It's hard to prevent this from not happening because there's so many things in VBA, it's hard to keep track of every methods, properties and actions.

Only if VBE came with a mind-reader....

"It looks like you are trying to make a function to reverse string.... May I suggest StrRev()?"



....


Now on second thought, it sounds a tad too much like Clippy. And Clippy makes me definitely not happy.


I need to go and find my happy place again.

;)
 
I have a yes/no field (tick box) on my report but basically I want this displayed as a Y or N. I wanted to add a label, hide the original field and on report open test if the field is yes or no and then update the label accordingly....

I dont know if this is the best way but any help would be very much appreciated!

Delete the original control, add a textbox, set the control source to that of your yes no field, set the display format to Yes/No. No code needed
 

Users who are viewing this thread

Back
Top Bottom