Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Location
    UK
    Posts
    233

    Unanswered: Expr: IF statement

    IS it possible to use an IF statement in an Expr: in a query?

    If so what is the correct syntax.

    Or the problem is I have created a Expr: that divides one filed by another. This works fine exept when one field is 0, giving me an error message.

    So if there is another way of resolving this, that would be great also

    Thanks

  2. #2
    Join Date
    Aug 2003
    Location
    UK
    Posts
    3
    To use an If Statement you need to use "IIF"

  3. #3
    Join Date
    Aug 2003
    Location
    Delft, The Netherlands (EU)
    Posts
    447
    Originally posted by dannymking
    To use an If Statement you need to use "IIF"
    Actually, you may choose between

    IIf(Condition, True-Expression, False-Expression) As Variant

    and

    Switch(Cond1, Result1, Cond2, Result2, ......, Condn, Resultn) as Variant

    In order to let Switch always return a result, it's usual to let Condn = TRUE
    Make everything as simple as possible, but not simpler! - A. Einstein
    DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •