Change data in a form to say something else on a report

  • Thread starter Thread starter m20ael
  • Start date Start date
M

m20ael

Guest
I want to select from a combo in a form the option either "Yes" or "No" but then display either "Y" or "N" respectively in a report. How?????

I have the box in the form all set up and I'm now trying to manipulate the data in the report. I have tried, in the expression box, this....

=IIf([Truant]="Yes","Y","N")

but this diplays a #Error.

The combo on the form is either yes or no but I only need a Y or an N on the report - am I on the right lines - or should I try something else?

Can someone please help?

Thanks
 
Is the form with the Yes/No combo box active at the time the report is open and do you want to grab the value off the current record on the form or is the Truant field read from a table?

Also, make sure the name of the text box on your report is not "Truant", rather something like "txtTruant".
 
I've set up the yes/no using the wizard whilst creating a combo in form. This then updates to a table where the report gathers its info. All of the info is there, and if I don't use the formula, then the report will display yes or no. (So all text box names seem to be correct). It's only when I use the formula - which has been copy and pasted from help - that #Error is diplayed!
 
You are probably getting #Error because the control name is the same as the field name, which is OK UNTIL you want to refer to the field in a formula (especially in the same control). Access thinks the formula in the control is referring to (the same) control, and not the field) which of course is a circular (and unresolvable) reference, so you get #Error. If you rename the control to differ from the name of the field, e.g. txtTruant, such as Rich suggested, then the ambiguity goes away, and Access knows that the Truant in your control formula refers to the field, and not the control, so it is no longer a circular reference, and #Error goes away!! Magic !!

HTH

Regards

John.
 

Users who are viewing this thread

Back
Top Bottom