Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQL help easy (Access 97)

    I would like to add the value of 3 and 2 to the statement below. Right now it only show the value of 2 not 3. I want the query to show everything with the value of 2 or 3. So the query will show every record whose field type is 2 or 3. How is this done? Thanks..

    If DomOnly Then
    FRQry = FRQry + "And " + Program + ".Type = '2'"

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: SQL help easy (Access 97)

    I assume you're assembling an SQL string in code. Try<pre>FRQry = FRQry & "And (" & Program & ".Type = '2' Or " & Program & ".Type = '3')"</pre>

    I used & instead of + to concatenate; you can use both but & is safer because it can't be confused with the addition operator for numbers. Note the use of parentheses; they are necessary because And has precedence over Or.

Posting Permissions

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