A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

conditional punctuation in a report



 
 
Thread Tools Display Modes
  #1  
Old September 21st, 2009, 02:49 PM posted to microsoft.public.access.gettingstarted
David Newmarch
external usenet poster
 
Posts: 58
Default 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  
Old September 21st, 2009, 03:18 PM posted to microsoft.public.access.gettingstarted
John Spencer
external usenet poster
 
Posts: 7,815
Default 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  
Old September 21st, 2009, 03:51 PM posted to microsoft.public.access.gettingstarted
StopThisAdvertising
external usenet poster
 
Posts: 334
Default 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  
Old September 22nd, 2009, 10:38 AM posted to microsoft.public.access.gettingstarted
David Newmarch
external usenet poster
 
Posts: 58
Default 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  
Old September 22nd, 2009, 10:43 AM posted to microsoft.public.access.gettingstarted
David Newmarch
external usenet poster
 
Posts: 58
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.