query parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • questionit
    Contributor
    • Feb 2007
    • 553

    query parameters

    I am setting parameters in Access Query but they wont work.
    I run the query, and i get the prompt and in input the required value but the query criteria doesn't change ..

    any help?
  • JKing
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #2
    Post the SQL for the query.

    Comment

    • questionit
      Contributor
      • Feb 2007
      • 553

      #3
      JKing

      nothing's wrong with my SQL query. i meant to say the Parameters feature in Access that we use to set up the parameters... once i have set any parameter, that doesn't make any differenc - the criteria remains the same , why's that
      Originally posted by JKing
      Post the SQL for the query.

      Comment

      • JKing
        Recognized Expert Top Contributor
        • Jun 2007
        • 1206

        #4
        Ok, I'm still unsure of what your problem is. Right now I'm assuming you have a query and within this query in the WHERE clause you have [Enter Value] or some other type of parameter. This is providing a prompt upon running the query to Enter Value. You enter the value yet the query results remain the same and unfiltered.

        Is this accurate? If not I'm going to need you to further explain your problem so I can understand what you're doing and help you get your query functioning properly. Examples are very helpful and maybe some insight into what you are doing.

        In either case I still think seeing the SQL would be helpful.

        Comment

        • questionit
          Contributor
          • Feb 2007
          • 553

          #5
          If you open any Query in Design View.
          Then goto Menu "Query" then click on "Parameters ". Now you see Query Parameters window.... If you put in any field and close it. Now execute the Query, you will be prompted to enter a value. Query will run but the value you entered would not make any difference - the critera wouldn't change.. why ?


          Originally posted by JKing
          Ok, I'm still unsure of what your problem is. Right now I'm assuming you have a query and within this query in the WHERE clause you have [Enter Value] or some other type of parameter. This is providing a prompt upon running the query to Enter Value. You enter the value yet the query results remain the same and unfiltered.

          Is this accurate? If not I'm going to need you to further explain your problem so I can understand what you're doing and help you get your query functioning properly. Examples are very helpful and maybe some insight into what you are doing.

          In either case I still think seeing the SQL would be helpful.

          Comment

          • JKing
            Recognized Expert Top Contributor
            • Jun 2007
            • 1206

            #6
            Originally posted by questionit
            If you open any Query in Design View.
            Then goto Menu "Query" then click on "Parameters ". Now you see Query Parameters window.... If you put in any field and close it. Now execute the Query, you will be prompted to enter a value. Query will run but the value you entered would not make any difference - the critera wouldn't change.. why ?
            Adding a parameter this way basically just adds a variable to your query. If you want it to filter your query results you will need to use it in your WHERE clause. Now had you posted your SQL in the first place I could have told you this several posts ago. You're right there probably isn't anything wrong with your SQL.

            It probably looks something like this:
            [code=sql]
            PARAMETERS myValue Text (255);
            SELECT field1, field2, field3
            FROM table1;
            [/code]

            So your query is functioning just as you have told it to. It gets the parameter and runs your select. You need to tell it what to do with that parameter.

            [code=sql]
            PARAMETERS myValue Text (255);
            SELECT field1, field2, field3
            FROM table1
            WHERE field1 = [myValue];
            [/code]

            Comment

            • questionit
              Contributor
              • Feb 2007
              • 553

              #7
              Thanks JKing..........

              Originally posted by JKing
              Adding a parameter this way basically just adds a variable to your query. If you want it to filter your query results you will need to use it in your WHERE clause. Now had you posted your SQL in the first place I could have told you this several posts ago. You're right there probably isn't anything wrong with your SQL.

              It probably looks something like this:
              [code=sql]
              PARAMETERS myValue Text (255);
              SELECT field1, field2, field3
              FROM table1;
              [/code]

              So your query is functioning just as you have told it to. It gets the parameter and runs your select. You need to tell it what to do with that parameter.

              [code=sql]
              PARAMETERS myValue Text (255);
              SELECT field1, field2, field3
              FROM table1
              WHERE field1 = [myValue];
              [/code]

              Comment

              Working...