Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2005

Tip: Looking for answers? Try searching our database.

Back Style conditional on a text field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JohnB - 29 Jul 2005 18:10 GMT
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
Brian - 29 Jul 2005 19:01 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.