Using the In or NOT In Clause with VBA Code Question??

Posted on 2010-01-05
Last Modified: 2012-05-08
Can the In or Not In clause be used directly in VBA code as shown below or should the IF or Select Case be used here.

If Me.DOCUMENT_NUMBER In(110, 112, 113, 117,119) Then
 'Do Something
End If

Question by:Eric Sherman
    LVL 119

    Accepted Solution

    use the select case

    select case me..DOCUMENT_NUMBER
        case  110, 112, 113, 117,119
                  'do something
        case else

    end select
    LVL 19

    Author Comment

    by:Eric Sherman
    Ahhhh ... Thanks capricorn1 ...  I don't use the Select Case very often and I kind of figured there was a way to specify multiples on the case line which is pretty much the same as the In clause.

    LVL 19

    Author Closing Comment

    by:Eric Sherman

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
    QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
    Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now