Open form with Where Condition Or Statement

Posted on 2011-10-23
Last Modified: 2013-11-27

I have been fiddling with this Or Statement in the following event.  I have no problem with 1 where statement but when I add " OR 178 OR 179" Where condition I have issues (Runtime error 13:  Type Mismatch).  I am sure I have the syntax wrong in the below Where "OR" conditions

Private Sub cmdAddbank_Click()

    DoCmd.OpenForm "frmLCIssued_Sum", , , "[BankID]= 1" Or "[BankID]= 178" Or "[BankID] = 179", , acDialog
End Sub

Question by:pdvsa
    LVL 33

    Accepted Solution

    Try this.
    "[BankID]= 1 Or [BankID]= 178 Or [BankID]=179"

    Open in new window

    Or this.
    "[BankID] In (1,178,179)"

    Open in new window


    Author Closing Comment


    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    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…
    In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

    754 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