Results 1 to 3 of 3
  1. #1
    alsoto is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2009
    Posts
    67

    Basic Syntax Question - Docmd.OpenReport In IIf Statement

    Can someone please tell me what is wrong with this?

    IIF(Me.SSN Is Null, (DoCmd.OpenReport "Report1" ,,,), (DoCmd.OpenForm "frmStudentsPaymentLedger2", acNormal))



    Thanks,
    Al

  2. #2
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    Read the help on "iif"

    It says that the true and false portion of the statement are always evaluated, regardless of the true/false test. It also says that both the true and false parts must return a result. Not sure about that for DoCmd.....

  3. #3
    alsoto is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2009
    Posts
    67

    Can't use VBA in an IIF statement

    Quote Originally Posted by hertfordkc View Post
    It says that the true and false portion of the statement are always evaluated, regardless of the true/false test. It also says that both the true and false parts must return a result. Not sure about that for DoCmd.....

    I believe that is the problem, can't use VBA in an IIF statement.

    Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 12-10-2018, 05:24 PM
  2. DoCmd OpenReport ... where condition with a Like
    By Grooz13 in forum Programming
    Replies: 4
    Last Post: 08-31-2010, 09:04 AM
  3. OpenReport Command with Double Check Where Statement
    By Robert M in forum Programming
    Replies: 3
    Last Post: 09-17-2009, 04:01 PM
  4. Can docmd.openreport print X copies on Y printer?
    By Coolpapabell in forum Reports
    Replies: 1
    Last Post: 09-02-2009, 08:35 AM
  5. Can I pass "sort by" using DoCmd.OpenReport
    By alsoto in forum Reports
    Replies: 3
    Last Post: 04-16-2009, 08:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums