Syntax error in query expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I'm new to MS Access and studies it through exploration and by reading Q&A's
from Microsoft.com.
I entered syntax query IIf([Field1]>1,(([Field1]+1)-[Field2])) in design
view of queries.This becomes Expr1: IIf([To]>1,(([Field1]+1)-[Field2])), when
I leave the cell. When I enter TableName on Table field and save query,
prompt "Syntax error (comma) in query expression
[TableName].[IIf([Field1]>1,(([Field1]+1)-[Field2]))]" appears. TableName is
same Table from which Field1 and Field 2 come from.
What did I do wrong here?
Also, How can I make the results of my queries appear on my desired fields?
Badly needing your help,
Abel
 
Take out the TableName from the Table field. If you have more than one
table in your query that use the same field names, your syntax would be

IIf(TableName.[Field1]>1,((TableName.[Field1]+1)-TableName.[Field2]))

Also, the syntax for IIf is IIF(Condition, True, False). There are no
optional parts to IIf, you need to have your statement do something
when your condition (Field1 > 1) is False.

Hope that helps!
 
Hi Jeff,
Thanks for making time. I did what you said but I can't say if it worked...
How can I make the result of my query appear on my desired field?

Thanks!
 

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

Back
Top