Results 1 to 5 of 5

Thread: Code help...

  1. #1
    Join Date
    Jul 2003
    Posts
    292

    Unanswered: Code help...

    I need some help with my SQL...

    How can I put Fixed = True

    I already have it to where it selects all records that have a REJ = y

    I need for it to display all records that have a REJ = Y or Fixed = True

    Fixed is a Yes/No field ..

    SELECT T.INSP, T.ACC
    FROM tblInspections AS T
    WHERE (((T.REJ)="y") AND ((T.strDate) Between [Forms]![Form2]![txtStartOpen2] And [Forms]![Form2]![txtStartEnd2])) OR (((T.strDate) Between [Forms]![Form2]![txtStartOpen2] And [Forms]![Form2]![txtStartEnd2])) OR (((T.REJ)="y") AND ((IsNull([Forms]![Form2]![txtStartOpen2]))<>False)) OR (((T.REJ)="y") AND ((IsNull([Forms]![Form2]![txtStartEnd2]))<>False));

    Thanks!

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Just for the heck of it try:

    SELECT T.INSP, T.ACC
    FROM tblInspections AS T
    WHERE ((((T.REJ)="y") OR (T.Fixed)="Yes")) AND ((T.strDate) Between [Forms]![Form2]![txtStartOpen2] And [Forms]![Form2]![txtStartEnd2])) OR (((T.strDate) Between [Forms]![Form2]![txtStartOpen2] And [Forms]![Form2]![txtStartEnd2])) OR (((T.REJ)="y") AND ((IsNull([Forms]![Form2]![txtStartOpen2]))<>False)) OR (((T.REJ)="y") AND ((IsNull([Forms]![Form2]![txtStartEnd2]))<>False));



  3. #3
    Join Date
    Jul 2003
    Posts
    292
    I actaully did try something like that.. but it didnt work..

    SELECT T.INSP, T.ACC
    FROM tblInspections AS T
    WHERE ((((T.REJ)="y") OR ((T.ACC)=Yes)) AND ((T.strDate) Between [Forms]![Form2]![txtStartOpen2] And [Forms]![Form2]![txtStartEnd2])) OR (((T.strDate) Between [Forms]![Form2]![txtStartOpen2] And [Forms]![Form2]![txtStartEnd2]) AND ((T.Fixed)=True)) OR (((T.REJ)="y") AND ((IsNull([Forms]![Form2]![txtStartOpen2]))<>False)) OR (((T.REJ)="y") AND ((IsNull([Forms]![Form2]![txtStartEnd2]))<>False));

    I also tried

    T.ACC = False

    nogo

    any other ideas ?

  4. #4
    Join Date
    Dec 2003
    Location
    Toronto, Ont. Canada
    Posts
    238
    Originally posted by TonyT
    I actaully did try something like that.. but it didnt work..

    SELECT T.INSP, T.ACC
    FROM tblInspections AS T
    WHERE ((((T.REJ)="y") OR ((T.ACC)=Yes)) AND ((T.strDate) Between [Forms]![Form2]![txtStartOpen2] And [Forms]![Form2]![txtStartEnd2])) OR (((T.strDate) Between [Forms]![Form2]![txtStartOpen2] And [Forms]![Form2]![txtStartEnd2]) AND ((T.Fixed)=True)) OR (((T.REJ)="y") AND ((IsNull([Forms]![Form2]![txtStartOpen2]))<>False)) OR (((T.REJ)="y") AND ((IsNull([Forms]![Form2]![txtStartEnd2]))<>False));

    I also tried

    T.ACC = False

    nogo

    any other ideas ?
    Hi Tony...

    In SQL statements data comparisions of different types need to be expressed different ways...

    For String comparisons, you surround the value with apostrophes or quotes...
    For Numeric comparisions, you don't need anything surrounding the values...
    For Date comparisons, you need # signs surrounding the values...
    For Boolean (yes/no... true/false... on/off) comparisons, you don't need anything surrounding the value... Yes/No fields also have numeric values of -1 (True) and 0 (False)

    If you are having problems using Fixed = True, try Fixed = -1....

    HTH

  5. #5
    Join Date
    Jul 2003
    Posts
    292
    Sorry bout that.. i got it.. I put down acc=true.. where it should be fixed = true..

    dumb mistakes..

    thanks for your help !

Posting Permissions

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