Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2008
    Posts
    15

    Unanswered: Querying according to user specified field

    Is it possible to have a query whereby a front-end user is asked to input a field which the query will use to search by? I am trying to use [text] in the field cell in the Query design but it is changed to Expr1: [text]. While the user is asked to enter a reponse, the query does not search according to the input.

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Put

    [What do you want to see in the FieldName?]

    Into the Criteria row of the FieldName you want to search by.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Jul 2008
    Posts
    15
    Yes, but is there a way I can have the user specify the FieldName? The criteria I will set on the backend

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Mnnn... never tried to do that in a query.... gonna have a quick play
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Mnn... nope... I don't think you can do that in a query. Some of the other SQL Jedi's around here might have a way...

    I would ask the user via a form and code in the building of the SQL statement. Then you could show a report using that SQL statement. All that is standard practice anyway though.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    What the OP is asking for can be achieved through dynamic SQL, which is rarely the best idea. How's about you create a new query for each field your users might want to filter on - and then let your users pick which query they wish to run?
    George
    Home | Blog

Posting Permissions

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