Sorry, Clemens, didn't mean to talk in GobbledyGook.
Open your query in Design View . (Go to View on the Menu Bar and click
Design View or find the button that looks like a blue set square.
You will see a grey area above which contains the tables on which your query
is built.
Below that are some white colums with black lines going across. Most of
these columns will contain your field names. Go to the first empty column
and type your formula in the top row. If there isn't an empty column, click
on any column and go to Insert > Column
You don't need the quotes around the bracket. at the end.
Just
OK: IIF([Approval Status] ="Approved","OK" ,"")
This means that if the field Approval Status says Approved, then print OK in
this field, if it doesn't say Approved then print a blank.
The Quote marks are there to tell Access that you want a String to appear
rather than a number. If you want a number then you wouldn't have the quote
marks.
eg MyPay: IIF([Amount]>5,5,3)
this means, if the number in field Amount is more than 5, Then put the
number 5 in the MyPay field. Otherwise put the number 3.
The 'grammar' is If This, then do this, Otherwise do that.
Evi
Clemens said:
The report is based on a query. The query is based on a table.
The column name is 'Approval State'. The value for any cell in this column
could be 'approved' or 'pending'. The 'approved' value needs to be changed to
'OK' and the value of 'pending' needs to be cleared/empty.
If I understand it correctly:
I open the report in wizar. Next I go to report properties and click to
record source. Now my query is visible.
And then I lost you.
Can I just create the line: OK: IIF([Approval Status] ="Approved","OK"," )"
Where do I need to fill this in? In the query At the 'Field' or 'Critieria'
line.
It could be possible (when this works) to change the layout of the report
(or other reports). Some of the values in to these collumns contains 3 diff.
values. That's why I asked the 2nd time if it is possible when a cell value
can contain 3 diff values
Thnx
Clemens
:
Hi Clemens,
Your report is based on a table or a query. In Design View of the report,
click on the Properties button and click next to Data Source in the grey
bar. If your report is based on a table, a message will appear 'Do you want
to Invoke the Query Builder?'
Choose Yes. Drag all the fields in the table into the query grid then in an
unused column, in the top row of the white lines in the grid, type in
LR: IIF([YourField] = "Left", "L", "R")
(Of course, instead of YourField you would type the name of the field that
has the text Left or Right in it)
The formula means. If YouField says Left, then put L here, otherwise put R
here)
Instead of putting [YourField] in your report, replace it with this LR
field.
Does you cell have 3 values (you did say it only had 2)? This can be done
too using a nested IIF statement. (I'll explain if you need this)
or, if you really want the initial letter of a the word then you can use
LR= Left([YourField],1)
Evi
Hi Evi, thanks for responding so quick.
The text only knows 2 values...ik mean the dat in a cell in 1 particulair
collumn. Let's say for example this cell only knowns the following 2
values:
'Left' or 'Right'.
I want to replace this text on the report by 'L' or 'R'.
I'm not sure if I understand your response. Where do I need to fill in the
line you suggested?
And how about cell with possible 3 values (Blue --> B; Green --> G and
Purple --> P)?
:
I don't quite understand the bit, 'The text knows only 2 values' but you
can
always replace stuff.
So lets say you want to replace the 2 values Pears or Bananas with a or
b.
You would have a field in the query on which the report is based whcih
reads
something like
AB: IIF([MyField]="Pears","a","b")
Now replace your text column with this one.
I guess most people think of reports like the Tardis where you can
always
squeeze yet another column onto the one page!
Evi
I have created a report with several columns. I need to enter an extra
collumn to the report, but that is causing the report to exeding the
size
limit. (is this correct english?? I dutch so I have an excuse ;-))
Some collumns have text in it. And the text knows only 2 vallues. Is
it
possible to replace the text for 1 single character. This way I can
smaller
some collumns to fit within the margins?