iif question

F

fanor

Hi guys,

I have a report with many field in detail section
one of them I want to have an IF

usgin properties I defined the expresion for datasource as

=IIf([year]>0,"",Str([year]))


[year] is the name of a field and the textbox's name is year too

so when i ran i got "#error" in the printing!!

Why it's not working???
I look up on the book and I din't find any error in sintax!
I'm missing something??


Thanks for any help
 
F

fanor

but when i used it without IIF it works!!
furthermore i got the some error when i apply IIF to a field named
mybal!!

Jim said:
Ooh. No, no, no.

Year is an Access reserved word - it is actually a function that
returns a number representing the year. Not a good idea to use them
for user defined object or properties. Here is link to them..

http://support.microsoft.com/defaul...port/kb/articles/Q109/3/12.asp&NoWebContent=1

- Jim

Hi guys,

I have a report with many field in detail section
one of them I want to have an IF

usgin properties I defined the expresion for datasource as

=IIf([year]>0,"",Str([year]))


[year] is the name of a field and the textbox's name is year too

so when i ran i got "#error" in the printing!!

Why it's not working???
I look up on the book and I din't find any error in sintax!
I'm missing something??


Thanks for any help
 
M

Mike Painter

fanor said:
but when i used it without IIF it works!!
furthermore i got the some error when i apply IIF to a field named
mybal!!
To reiterate:
" Year is an Access reserved word - it is actually a function that returns
a number representing the year. Not a good idea to use them for user
defined object or properties."

You can ignore this advice if you wish but you are very lucky to have the
problem pop up now in such a visible location and always cause a problem.

Access should just pop an error message whenever you try to use a reserved
word but it does not do this.
 
S

Steve Schapel

Fanor,

The reason for this problem is that you have a control on your report,
which is named the same as a field (i.e. [year]) in the report's record
source, but is not bound to that field. The solution is to rename the
textbox to something else.
 

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

Top