Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Type mismatch win In statement

Posted on 2011-04-27
4
Medium Priority
?
315 Views
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?
0
Comment
Question by:Shawn
  • 3
4 Comments
 
LVL 75
ID: 35479742
The IN() operator only works in a Query (SQL), not in VBA.

mx
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 35479757
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

mx
0
 
LVL 1

Author Comment

by:Shawn
ID: 35479769
ah right. thanks for the refresher :)
0
 
LVL 75
ID: 35479782
You are welcome.

mx
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

572 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