MS Access IIF error on report

K

Kenny Miller

I have been trying to run the following IIF in a report

=IIf([Neighborhood]="Downtown Brooklyn","Downtown",[Neighborhood])
but I get #error in the report

when I replace the feild with test & run the report it works
=IIf([test]="Downtown Brooklyn","Downtown",[test])
however this is a table which I need to download & replace often.

Any Suggestions?
 
R

Rob Parker

The most likely cause is that the textbox control is also named
Neighborhood. Change it to txtNeighborhood and your problem should go away.
It's a common problem, caused by Access's default names. To avoid it, use a
naming convention for your controls (and turn off Name Autocorrect in your
application).

HTH,

Rob
 
S

Steve Schapel

Rob said:
It's a common problem, caused by Access's default names...

Weeell, not exactly. Access's default names apply to controls that are
directly bound to the fields of the same name, which is not a problem.
The problems arise when a control has the same name as a field in the
record source, but is is *not* bound to that field. This situation is
always the result of user intervention, and is never done by Access by
default.
 
L

Larry Linson

Another possibility: Is [Neighborhood] the Control Source of a Control on
the Report? Access reports are "smart enough" that they may eliminate fields
specified in the Record Source if they aren't actually displayed.

Larry Linson
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top