Hi.
Is it possible to have the Back Style of a control dependant on content/no
content in a text field on the same form? I have an Image control called
imgTheImage and a text field txtImagePathAndFile. If the text field has
content, I want the Back Style of imgTheImage to be "Normal", otherwise
"Transparent". I was thinking of On Current event code. Can this be done?
Thanks for any help. JohnB
Private Form_Current()
If not IsNull(txtImagePathAndFile) then
imgTheImage.BackStyle = 1
Else
imgTheImage.BackStyle = 0
End Sub
> Hi.
>
[quoted text clipped - 5 lines]
>
> Thanks for any help. JohnB
JohnB - 29 Jul 2005 20:26 GMT
That works perfectly Brian. Thank you. JohnB
> Private Form_Current()
> If not IsNull(txtImagePathAndFile) then
[quoted text clipped - 12 lines]
> >
> > Thanks for any help. JohnB
Klatuu - 29 Jul 2005 20:31 GMT
You should also put the same code in the After Update evento of the control
so that when data is entered or deleted, it will change color.
> Private Form_Current()
> If not IsNull(txtImagePathAndFile) then
[quoted text clipped - 12 lines]
> >
> > Thanks for any help. JohnB
JohnB - 29 Jul 2005 20:37 GMT
Thank you - I hadn't thought of that. I'll look into it. Much appreciated.
JohnB
> You should also put the same code in the After Update evento of the control
> so that when data is entered or deleted, it will change color.
[quoted text clipped - 15 lines]
> > >
> > > Thanks for any help. JohnB
JohnB - 30 Jul 2005 13:10 GMT
Hi again Brian.
I wonder if you are still watching this thread. If I don't hear from you
I'll repost. As I said earlier, you code works perfectly but I've noticed
that, when a new blank record is selected for data entry, text field
txtImagePathAndFile is somehow treated as having content. It's control
source is a DLookUp and shows as #Error in a blank record. Could the text
field be made truly IsNull in a new blank record or could you make a change
to your suggested code to ensure that this condition is treated as the field
being IsNull.
By the way, I tried turning your code on its head as follows, but that
didn't work either. It seems that when the text field is showing #Error it
neither has nor has not content.
Private Form_Current()
If IsNull(txtImagePathAndFile) then
imgTheImage.BackStyle = 0
Else
imgTheImage.BackStyle = 1
End Sub
Not the most major of problems, of course, but it would round things off
nicely if I could solve this.
Thanks again, JohnB
> Private Form_Current()
> If not IsNull(txtImagePathAndFile) then
[quoted text clipped - 12 lines]
> >
> > Thanks for any help. JohnB