Query "or" help needed.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #16
    Originally posted by Rotor
    Ding!

    Thank you very much.

    Great stuff, if it is any consolation I am off for the rest of the week, so I wont pester you guys any more...until then :).
    No problem. Glad you've got it working.

    Mary

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32669

      #17
      Originally posted by Rotor
      Ding!

      Thank you very much.

      Great stuff, if it is any consolation I am off for the rest of the week, so I wont pester you guys any more...until then :).
      Until then, then :) (What did I just let myself in for :D)

      Comment

      • Rotor
        New Member
        • Nov 2006
        • 72

        #18
        Originally posted by NeoPa
        Until then, then :) (What did I just let myself in for :D)
        Hiya Neo,

        One more question on this subject. I would like to take this code a little bit further and maybe you or mccarthy can tell me how I can make this work if possible:

        Code:
        WHERE (((tblEmployees.[Employee Number])=[Enter Emp #])
          And IIf(IsNull([Enter Task Type]),[Task Type] In ('Borescope','ET','PT','UT','RT'),[Task Type]=[Enter Task Type])
          And ((tblAcftJobsComp.[Created Date Local])>=[From Dte mm/dd/yy]));
        To the above code I would like to add
        Code:
        =Nz([Enter Date mm/dd/yy], DateAdd("d", 30, Now))))
        I am not sure how to work it in with the >= comparison operator. I am asking the user from what date he wants to display the records. However, based on previous ideas, if he leaves the field blank, I would like the query to return the past 30 days.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32669

          #19
          I can't get to this now as it's been hectic all day.
          It looks like you're on the right lines - I'll have a look later at finalising the details for you :)

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32669

            #20
            Try using :
            Code:
            ...>Nz([Enter Date mm/dd/yy], DateAdd("d", -30, Date()))
            Let me know if that works. If not then post your current SQL code but try to lay it out so that I can read it without copying it to a text-editor first.

            Comment

            • Rotor
              New Member
              • Nov 2006
              • 72

              #21
              Originally posted by NeoPa
              Try using :
              Code:
              ...>Nz([Enter Date mm/dd/yy], DateAdd("d", -30, Date()))
              Let me know if that works. If not then post your current SQL code but try to lay it out so that I can read it without copying it to a text-editor first.
              Good Morning Neopa,

              I tried the above and I am getting a syntax error. Here is the SQL:

              Code:
              And ((tblAcftJobsComp.[Created Date Local])
              >Nz([Enter Date mm/dd/yy], DateAdd("d", -30, Date()));
              Hope I layed it out okay for ya, wasnt sure what you meant, so I assumed to mean to break it up in the window.

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32669

                #22
                It's hard without the full SQL (Well laid out by the way - perfectly readable), but immediately obvious is that you've introduced an unclosed opening parenthesis '('. Try balancing them all up properly first, then, if that won't work, post the full SQL & I'll check it for you. If there's anything more to the error message that would be helpful too.

                Comment

                • Rotor
                  New Member
                  • Nov 2006
                  • 72

                  #23
                  Originally posted by NeoPa
                  It's hard without the full SQL (Well laid out by the way - perfectly readable), but immediately obvious is that you've introduced an unclosed opening parenthesis '('. Try balancing them all up properly first, then, if that won't work, post the full SQL & I'll check it for you. If there's anything more to the error message that would be helpful too.
                  Okay, parenthesis fixed. Thxs.

                  Now to deal with that other thread :). I am going to address the field naming issue foist, then get back to you with the rest.

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32669

                    #24
                    Sounds fine.
                    Well done for fixing the parentheses :) Glad to hear it fixed the problem.

                    Comment

                    Working...