Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

report expression(as copied from microsoft help example) syntax error

Status
Not open for further replies.

pauljkeenan

Programmer
Jun 19, 2006
41
TR
Hi Guys

Could anyone help me with the syntax for this expression Im using on a report. The textbox field is supposed to display yes or no depending on the text in another field. So on my report I have the fields listed like name, job, fee, currency simply listed from a table. The last textbox field should display a "yes" if [currency] is YTL and "no" if [currency] is not. sounds easy? I thought so, and it probably is.

Well I decided to check the access help first of all for some examples and I found exactly what I was looking for. So I copied and pasted what I found and added it as the control source for the field. Here's the code

=IIf([Currency] = "YTL", "Yes", "No")

and here's the microsft example which I copied from
=IIf([Confirmed] = "Yes", "Order Confirmed", "Order Not Confirmed")

as soon as I try to come out of design view I get an error saying the syntax is wrong but unfortunately its very vague.

anybody?

any help is very much appreciated
 
I believe Currency is a reserved word.
Name the text box that holds the field Currency to txtCurrency and the change your expression to:
=IIf(Me.txtCurrency = "YTL", "Yes", "No")

Hopefully this will work.
 
Hi John

Thanks for the reply, I just tried as you advise but it still gives me a syntax error again, saying there is an extra comma or bracket. I also changed the name of currency field to curr but it didnt solve the problem. To find out what the problem could be i copied an expression example from the access help section and pasted into the report it also gave me syntax errors. it was just something simple like format now(). I think there's a problem with my access because there is no help section currently, says its uninstalled.

thanks again though
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top