|
tech
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Conditional formatting based on the Row Source in another control.in another control? This is a sub form (sfrmKeys) with the following SQL: Row Source: SELECT [tblLocks].[LockID], [tblLocks].[Location], [tblWings].[WingDescription], [tblBuildings].[BuildingDescription], [tblBuildings].[Active], IIf([Active]=False,[BuildingDescription] & " (Ret.)",[BuildingDescription]) AS [Retired Bldgs] FROM tblBuildings INNER JOIN (tblWings RIGHT JOIN tblLocks ON [tblWings].[WingID]=[tblLocks].[WingID]) ON [tblBuildings].[BuildingID]=[tblLocks].[BuildingID] ORDER BY [tblLocks].[Location]; The Control Source of txtBuilding is: =[cboSelectLock].Column(5) I didn’t account for bldgs being retired so I’m trying to fix everything now. What I would like to happen is that only “(Ret.)†turns red if the bldg is retired. Since the Row Source is for cboSelectLock, I didn’t know how to get it to do what I want for txtBuilding. -- Aria W. Use conditional formatting
Change the Field Value is to Expression is Enter the following as the expression [Name of the Text Box] = "(Ret.)" And set up the format If that fails try [cboSelectLock].Column(5) = "(Ret.)" as the expression '==================================================== John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County '==================================================== Aria wrote: Show quoteHide quote > How do you conditionally format a text box that is based on an IIF statement > in another control? > > This is a sub form (sfrmKeys) with the following SQL: > > > Row Source: SELECT [tblLocks].[LockID], [tblLocks].[Location], > [tblWings].[WingDescription], [tblBuildings].[BuildingDescription], > [tblBuildings].[Active], IIf([Active]=False,[BuildingDescription] & " > (Ret.)",[BuildingDescription]) AS [Retired Bldgs] FROM tblBuildings INNER > JOIN (tblWings RIGHT JOIN tblLocks ON > [tblWings].[WingID]=[tblLocks].[WingID]) ON > [tblBuildings].[BuildingID]=[tblLocks].[BuildingID] ORDER BY > [tblLocks].[Location]; > > The Control Source of txtBuilding is: > =[cboSelectLock].Column(5) > > > I didn’t account for bldgs being retired so I’m trying to fix everything > now. What I would like to happen is that only “(Ret.)†turns red if the bldg > is retired. Since the Row Source is for cboSelectLock, I didn’t know how to > get it to do what I want for txtBuilding. > Unfortunately, neither method worked. There wasn't any change. I did change
it to "Expression is". I don't know if I was clear in my previous post but just in case it makes a difference there is a building description in front of "Ret.". For example, it may say Technology, (Ret.) -- Show quoteHide quoteAria W. "John Spencer" wrote: > Use conditional formatting > Change the Field Value is to Expression is > Enter the following as the expression > [Name of the Text Box] = "(Ret.)" > And set up the format > > > If that fails try > [cboSelectLock].Column(5) = "(Ret.)" > as the expression > > > '==================================================== > John Spencer > Access MVP 2002-2005, 2007-2009 > The Hilltop Institute > University of Maryland Baltimore County > '==================================================== > > > Aria wrote: > > How do you conditionally format a text box that is based on an IIF statement > > in another control? > > > > This is a sub form (sfrmKeys) with the following SQL: > > > > > > Row Source: SELECT [tblLocks].[LockID], [tblLocks].[Location], > > [tblWings].[WingDescription], [tblBuildings].[BuildingDescription], > > [tblBuildings].[Active], IIf([Active]=False,[BuildingDescription] & " > > (Ret.)",[BuildingDescription]) AS [Retired Bldgs] FROM tblBuildings INNER > > JOIN (tblWings RIGHT JOIN tblLocks ON > > [tblWings].[WingID]=[tblLocks].[WingID]) ON > > [tblBuildings].[BuildingID]=[tblLocks].[BuildingID] ORDER BY > > [tblLocks].[Location]; > > > > The Control Source of txtBuilding is: > > =[cboSelectLock].Column(5) > > > > > > I didn’t account for bldgs being retired so I’m trying to fix everything > > now. What I would like to happen is that only “(Ret.)†turns red if the bldg > > is retired. Since the Row Source is for cboSelectLock, I didn’t know how to > > get it to do what I want for txtBuilding. > > > Then you need to edit the expression to
[Name of the Text Box] LIKE "*(Ret.)" Which says if the value ends in (Ret.) then apply the conditional formatting. If there is anything after (Ret.) then you will need to add another asterisk after the closing parenthesis. Then the expression will be true if (Ret.) is anywhere in the value. '==================================================== John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County '==================================================== Aria wrote: Show quoteHide quote > Unfortunately, neither method worked. There wasn't any change. I did change > it to "Expression is". I don't know if I was clear in my previous post but > just in case it makes a difference there is a building description in front > of "Ret.". For example, it may say Technology, (Ret.) Well, this is the closest I've gotten so far. What's happening is that
everything inside the text box is red and bold. I guess I could live with it if there isn't another way but I would really like just (Ret.) to have the formatting. This is what I put: Expression is [txtBuilding] LIKE "*(Ret.)" -- Show quoteHide quoteAria W. "John Spencer" wrote: > Then you need to edit the expression to > [Name of the Text Box] LIKE "*(Ret.)" > > Which says if the value ends in (Ret.) then apply the conditional > formatting. If there is anything after (Ret.) then you will need to add > another asterisk after the closing parenthesis. Then the expression > will be true if (Ret.) is anywhere in the value. > > '==================================================== > John Spencer > Access MVP 2002-2005, 2007-2009 > The Hilltop Institute > University of Maryland Baltimore County > '==================================================== > > > Aria wrote: > > Unfortunately, neither method worked. There wasn't any change. I did change > > it to "Expression is". I don't know if I was clear in my previous post but > > just in case it makes a difference there is a building description in front > > of "Ret.". For example, it may say Technology, (Ret.) > No, conditional formatting will be applied to the entire contents of the source.
If you are working with Access 2007 and use rich text you can probably use some VBA to highlight just the portion you want. Personally, I wouldn't bother as it feels like too much trouble. John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County Aria wrote: Show quoteHide quote > Well, this is the closest I've gotten so far. What's happening is that > everything inside the text box is red and bold. I guess I could live with it > if there isn't another way but I would really like just (Ret.) to have the > formatting. > This is what I put: > Expression is [txtBuilding] LIKE "*(Ret.)" OK, I guess I'm done then. :-)
Thank you very much, John. -- Show quoteHide quoteAria W. "John Spencer MVP" wrote: > No, conditional formatting will be applied to the entire contents of the source. > > If you are working with Access 2007 and use rich text you can probably use > some VBA to highlight just the portion you want. Personally, I wouldn't > bother as it feels like too much trouble. > > John Spencer > Access MVP 2002-2005, 2007-2009 > The Hilltop Institute > University of Maryland Baltimore County > > Aria wrote: > > Well, this is the closest I've gotten so far. What's happening is that > > everything inside the text box is red and bold. I guess I could live with it > > if there isn't another way but I would really like just (Ret.) to have the > > formatting. > > This is what I put: > > Expression is [txtBuilding] LIKE "*(Ret.)" >
Divide One Field into 3 parts
Linking form information to specific tables repeat information in report (Access 2007) Report - how to print each page to new document. Report in Legal size Table Set-up Daily download relationships Auto populate month & year How do i dicount a field in access like cost? |
|||||||||||||||||||||||