Results 1 to 12 of 12
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Ephrata, Washington, USA
    Posts
    683
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA/VB and IIF Statement (Office XP)

    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?

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA/VB and IIF Statement (Office XP)

    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

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: VBA/VB and IIF Statement (Office XP)

    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

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA/VB and IIF Statement (Office XP)

    IIF is part of VBA, nothing Access dependent.

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA/VB and IIF Statement (Office XP)

    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.

  6. #6
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Reading/Swindon, Berkshire, United Kingdom
    Posts
    664
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA/VB and IIF Statement (Office XP)

    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.

  7. #7
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA/VB and IIF Statement (Office XP)

    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.

  8. #8
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: VBA/VB and IIF Statement (Office XP)

    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.
    Wendell

  9. #9
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA/VB and IIF Statement (Office XP)

    Yes, but this thread is about VB/VBA.

  10. #10
    Lounger
    Join Date
    Mar 2002
    Location
    Australia
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA/VB and IIF Statement (Office XP)

    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.

  11. #11
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Reading/Swindon, Berkshire, United Kingdom
    Posts
    664
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA/VB and IIF Statement (Office XP)

    A valid point! <img src=/S/grin.gif border=0 alt=grin width=15 height=15> I was just trying to clarify - sorry if that went wrong.

  12. #12
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: VBA/VB and IIF Statement (Office XP)

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

Posting Permissions

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