If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
conditional punctuation in a report
In a report I want the value of a textbox to appear within parentheses when a
Yes/No field in the underlying query is positive and without parentheses if the Yes/No field negative. For example, if the value of checkbox chkActive is True, and the value of textbox txtOrderID is, say, CW259, then I want that value to appear in the textbox without any punctuation as "CW259". If chkActive is False then I want the value to appear in parenthesies as "(CW259)". I assume that it might be done with some sort of "On Load" code, but I have no idea how to code the presence or absence of the desired punctuation. Can anyone suggest a way to do this? Very grateful for any light you can shed. |
#2
|
|||
|
|||
conditional punctuation in a report
I will assume that you are sorting by the value of orderId.
Assumption: field names are Active and OrderID You can set the control's source to: =IIF([Active]=True,"(" & [OrderID] & ")",[OrderID]) John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County David Newmarch wrote: In a report I want the value of a textbox to appear within parentheses when a Yes/No field in the underlying query is positive and without parentheses if the Yes/No field negative. For example, if the value of checkbox chkActive is True, and the value of textbox txtOrderID is, say, CW259, then I want that value to appear in the textbox without any punctuation as "CW259". If chkActive is False then I want the value to appear in parenthesies as "(CW259)". I assume that it might be done with some sort of "On Load" code, but I have no idea how to code the presence or absence of the desired punctuation. Can anyone suggest a way to do this? Very grateful for any light you can shed. |
#4
|
|||
|
|||
conditional punctuation in a report
"Steve" schreef in bericht m... Hello David, Open your report in design view and select txtOrderID. Open properties and go to the Data tab. Put the following expression in the Control Source property: =IIF([chkActive],"CW259","(CW259)") Steve -- Get lost $teve. Go away... far away.... No-one wants you here... no-one needs you here... OP look at http://home.tiscali.nl/arracom/whoissteve.html For those who don't 'agree' with this mail , bacause $teve was 'helpfull' with his post... We warned him a thousand times... Sad, but he is not willing to stop advertising... He is just toying with these groups... advertising like hell... on and on... for years... oh yes... and sometimes he answers questions... indeed... and sometimes good souls here give him credit for that... == We are totally 'finished' with $teve now... == Killfile 'StopThisAdvertising' and you won't see these mails.... Arno R |
#5
|
|||
|
|||
conditional punctuation in a report
Thanks very much John, problem solved. I had already, unsuccessfully, tried
this solution, except that I forgot the need for the square brackets! I seldom have to write expressions, and I'm obviously very rusty. Your help is much appreciated. David "John Spencer" wrote: I will assume that you are sorting by the value of orderId. Assumption: field names are Active and OrderID You can set the control's source to: =IIF([Active]=True,"(" & [OrderID] & ")",[OrderID]) John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County David Newmarch wrote: In a report I want the value of a textbox to appear within parentheses when a Yes/No field in the underlying query is positive and without parentheses if the Yes/No field negative. For example, if the value of checkbox chkActive is True, and the value of textbox txtOrderID is, say, CW259, then I want that value to appear in the textbox without any punctuation as "CW259". If chkActive is False then I want the value to appear in parenthesies as "(CW259)". I assume that it might be done with some sort of "On Load" code, but I have no idea how to code the presence or absence of the desired punctuation. Can anyone suggest a way to do this? Very grateful for any light you can shed. |
#6
|
|||
|
|||
conditional punctuation in a report
Sorry Steve, even I can see that this is a useless answer. I made it pretty
clear that "CW259" is just ONE possible value for the control. "Steve" wrote: Hello David, Open your report in design view and select txtOrderID. Open properties and go to the Data tab. Put the following expression in the Control Source property: =IIF([chkActive],"CW259","(CW259)") Steve "David Newmarch" wrote in message ... In a report I want the value of a textbox to appear within parentheses when a Yes/No field in the underlying query is positive and without parentheses if the Yes/No field negative. For example, if the value of checkbox chkActive is True, and the value of textbox txtOrderID is, say, CW259, then I want that value to appear in the textbox without any punctuation as "CW259". If chkActive is False then I want the value to appear in parenthesies as "(CW259)". I assume that it might be done with some sort of "On Load" code, but I have no idea how to code the presence or absence of the desired punctuation. Can anyone suggest a way to do this? Very grateful for any light you can shed. |
Thread Tools | |
Display Modes | |
|
|