• VBA/VB and IIF Statement (Office XP)

    • This topic has 11 replies, 8 voices, and was last updated 23 years ago.
    Author
    Topic
    #372671

    We are going to upgrading from Office 97 to Office XP. I understand that XP uses VB6 instead of VBA. I have two questions: (1) What do you lose when you convert from VBA to VB? What commands won’t work anymore? (2) How does VB Handle the IIF command? Does it convert to something else?

    Viewing 2 reply threads
    Author
    Replies
    • #596388

      Where did you get this information?

      Office XP still uses VBA.

      AFAIK, IIF is a function that belongs only to Access. That function is still alive and well in Access 2002 (XP).

      HTH

      • #596416

        IIF is part of VBA, nothing Access dependent.

        • #596422

          Yes and no:

          IIf is a VBA function that – AFAIK – can be used in all applications that support VBA. But Access is the only application I know of that you can use it in without touching a VBA code module. So to me, although it may just be the equivalent of Excel’s IF, since you can’t use the same name in both applications it is “special” to Access.

          • #596446

            IIF Can be freely used with VBA.
            If you look at the Help, or Object Browser, in Access VBA, you will find IIF defined as it is for all other VBA apps.

            • #596472

              Brooke’s point is that you can also use it in SQL statements which nothing to do with VBA, making Access unique in that respect.

            • #596481

              Yes, but this thread is about VB/VBA.

            • #596484

              The original question is “How does VB Handle the IIF command? “. I dont feel any special for VB handling IIF function than VBA or Access. I used it several times in my VB6 applications (with NZ function) to covert Null to something, nothing wrong, nothing special. Although my DB is Access, the part of code I use IIF doesnt deal with DB directly. I m not sure it is a must to link Access for using IIF. If you check MSDN of VB6 for IIF fuction, it doesnt mention anything abt ACCESS.

            • #596489

              A valid point! grin I was just trying to clarify – sorry if that went wrong.

            • #596502

              No need to apologize. You can’t separate VB and VBA that neatly.

    • #596390

      Perhaps the confusion arises because the ‘VB’ part of Office 97 VBA is VB5, while the ‘VB’ part of VBA in Office 2000/Office XP is VB6.

      So you’re not losing anything in moving from Office 97 VBA to Office XP VBA; VB6 has some features that VB5 lacks (rather than the other way round).

      The IIf function is definitely a built in function in VB6 and you should be able to continue to use it as is.

      Gary

    • #596417

      Note that IIF executes more slowly than the equivalent If THen Else AND could have side-effects as both alternatives are evaluated, not just 1.

    Viewing 2 reply threads
    Reply To: VBA/VB and IIF Statement (Office XP)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: