Type mismatch win In statement

Posted on 2011-04-27
Last Modified: 2012-05-11
on an after update event I have code to see if the Country ID is one of a little list of IDs.

I am getting a type mismatch for this:
If "Me![Country] In(2,3,4,13,25,9,27,28)" Then
Me![VAT] = False
end if

what am I doing wrong here?
Question by:Shawn
    LVL 75

    Expert Comment

    by:DatabaseMX (Joe Anderson - Access MVP)
    The IN() operator only works in a Query (SQL), not in VBA.

    LVL 75

    Accepted Solution

    You can do this instead:

        Select Case Me![Country]
            Case 2, 3, 4, 13, 25, 9, 27, 28
                Me![VAT] = False
            Case Else
                ' do whatever
        End Select

    LVL 1

    Author Comment

    ah right. thanks for the refresher :)
    LVL 75

    Expert Comment

    by:DatabaseMX (Joe Anderson - Access MVP)
    You are welcome.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    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…
    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
    In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

    737 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

    20 Experts available now in Live!

    Get 1:1 Help Now