Can "if" be used in expressions?

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

Guest

I am trying to use a simple query to display certain data from my table. The
easiest way would be to use an expression with an "IF" statement, but I keep
getting an error when I try. I also noticed that if I go to the Expression
Builder, there is not "IF" available. Does this mean I can't use an IF
statement in Access?

Thanks.
 
What are you trying to accomplish?

The whole point of a query is to pull records IF a certain condition exists.
This usually just requires an entry in the "Criteria:" field in the query
design grid.

Tell us what your actual fields are and what the conditions are and we can
help you build the query if you can't figure it out.
 
You should use iif the query
So something like this

If FieldName = 10 Then
Display "aaaa"
Else
Display "bbbb"
End If

Will become in the Query

Expr : IIf(FieldName = 10, "aaaa","bbbb")
 

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