QUERY BASED ON TEXT BOX

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RICHARD BROMBERG

    QUERY BASED ON TEXT BOX

    I am using MS Access 2000 and crating an application where the main table
    has about 90 fields.
    I understand how to run a where the value of a PARTICULAR field is entered
    into a text box.

    I want to allow the user to enter the FIELD into one text box and the
    CRITERIA into another text box and then run a query based on the values
    entered.

    I'd appreciate any ideas how to do this

    Thanks





  • Bas Cost Budde

    #2
    Re: QUERY BASED ON TEXT BOX

    90 fields is a lot. It leads me into thinking that your design may need
    further normalisation. Especially if your user wants to enter the field
    name: fields should contain data, not *be* data.

    Try creating two columns, one with the current field names, the other
    with their contents. That way, your user can enter two values which you
    then can find in the fields.

    RICHARD BROMBERG wrote:[color=blue]
    > I am using MS Access 2000 and crating an application where the main table
    > has about 90 fields.
    > I understand how to run a where the value of a PARTICULAR field is entered
    > into a text box.
    >
    > I want to allow the user to enter the FIELD into one text box and the
    > CRITERIA into another text box and then run a query based on the values
    > entered.
    >
    > I'd appreciate any ideas how to do this
    >
    > Thanks
    >
    >
    >
    >
    >[/color]

    --
    Bas Cost Budde

    Comment

    • RICHARD BROMBERG

      #3
      Re: QUERY BASED ON TEXT BOX

      Well I thought I knew how to run a query where the value of a PARTICULAR
      field is entered
      into a text box, BUT I WAS WRONG.

      I had done this in the past but don't remember how I did it. .

      "RICHARD BROMBERG" <dickbrom@world net.att.net> wrote in message
      news:8F8Sb.1347 47$6y6.2621079@ bgtnsc05-news.ops.worldn et.att.net...[color=blue]
      > I am using MS Access 2000 and crating an application where the main table
      > has about 90 fields.
      > I understand how to run a where the value of a PARTICULAR field is entered
      > into a text box.
      >
      > I want to allow the user to enter the FIELD into one text box and the
      > CRITERIA into another text box and then run a query based on the values
      > entered.
      >
      > I'd appreciate any ideas how to do this
      >
      > Thanks
      >
      >
      >
      >
      >[/color]


      Comment

      • RICHARD BROMBERG

        #4
        Re: QUERY BASED ON TEXT BOX

        I am porting the application from something written in Dbase IV and don't
        have much flexibility in file/table layouts.


        "Bas Cost Budde" <bas@heuveltop. org> wrote in message
        news:bvb5gp$jma $1@news2.solcon .nl...[color=blue]
        > 90 fields is a lot. It leads me into thinking that your design may need
        > further normalisation. Especially if your user wants to enter the field
        > name: fields should contain data, not *be* data.
        >
        > Try creating two columns, one with the current field names, the other
        > with their contents. That way, your user can enter two values which you
        > then can find in the fields.
        >
        > RICHARD BROMBERG wrote:[color=green]
        > > I am using MS Access 2000 and crating an application where the main[/color][/color]
        table[color=blue][color=green]
        > > has about 90 fields.
        > > I understand how to run a where the value of a PARTICULAR field is[/color][/color]
        entered[color=blue][color=green]
        > > into a text box.
        > >
        > > I want to allow the user to enter the FIELD into one text box and the
        > > CRITERIA into another text box and then run a query based on the values
        > > entered.
        > >
        > > I'd appreciate any ideas how to do this
        > >
        > > Thanks
        > >
        > >
        > >
        > >
        > >[/color]
        >
        > --
        > Bas Cost Budde
        >[/color]


        Comment

        • Bas Cost Budde

          #5
          Re: QUERY BASED ON TEXT BOX

          Compose the SQL for the query from code.

          Suppose your field name control is called fldNam, and the field value
          control is fldValue. You could get at something like

          dim cSQL as string
          cSQL = "SELECT * FROM yourTable WHERE " & fldName & " = '" & fldValue & "'"

          To view the resulting dataset, you could create a query on it.

          RICHARD BROMBERG wrote:
          [color=blue]
          > Well I thought I knew how to run a query where the value of a PARTICULAR
          > field is entered
          > into a text box, BUT I WAS WRONG.
          >
          > I had done this in the past but don't remember how I did it. .
          >
          > "RICHARD BROMBERG" <dickbrom@world net.att.net> wrote in message
          > news:8F8Sb.1347 47$6y6.2621079@ bgtnsc05-news.ops.worldn et.att.net...
          >[color=green]
          >>I am using MS Access 2000 and crating an application where the main table
          >>has about 90 fields.
          >>I understand how to run a where the value of a PARTICULAR field is entered
          >>into a text box.
          >>
          >>I want to allow the user to enter the FIELD into one text box and the
          >>CRITERIA into another text box and then run a query based on the values
          >>entered.
          >>
          >>I'd appreciate any ideas how to do this
          >>
          >>Thanks
          >>
          >>
          >>
          >>
          >>[/color]
          >
          >
          >[/color]

          --
          Bas Cost Budde

          Comment

          • Mike Storr

            #6
            Re: QUERY BASED ON TEXT BOX

            The field where the user chooses a table field name could also be a combobox
            that has a recordsourcetyp e Field List. The choose the appropriate table for
            the list. Use the combobox value in the SQL example already provided.

            Mike Storr




            "Bas Cost Budde" <bas@heuveltop. org> wrote in message
            news:bvb9mq$k2c $1@news2.solcon .nl...[color=blue]
            > Compose the SQL for the query from code.
            >
            > Suppose your field name control is called fldNam, and the field value
            > control is fldValue. You could get at something like
            >
            > dim cSQL as string
            > cSQL = "SELECT * FROM yourTable WHERE " & fldName & " = '" & fldValue &[/color]
            "'"[color=blue]
            >
            > To view the resulting dataset, you could create a query on it.
            >
            > RICHARD BROMBERG wrote:
            >[color=green]
            > > Well I thought I knew how to run a query where the value of a PARTICULAR
            > > field is entered
            > > into a text box, BUT I WAS WRONG.
            > >
            > > I had done this in the past but don't remember how I did it. .
            > >
            > > "RICHARD BROMBERG" <dickbrom@world net.att.net> wrote in message
            > > news:8F8Sb.1347 47$6y6.2621079@ bgtnsc05-news.ops.worldn et.att.net...
            > >[color=darkred]
            > >>I am using MS Access 2000 and crating an application where the main[/color][/color][/color]
            table[color=blue][color=green][color=darkred]
            > >>has about 90 fields.
            > >>I understand how to run a where the value of a PARTICULAR field is[/color][/color][/color]
            entered[color=blue][color=green][color=darkred]
            > >>into a text box.
            > >>
            > >>I want to allow the user to enter the FIELD into one text box and the
            > >>CRITERIA into another text box and then run a query based on the values
            > >>entered.
            > >>
            > >>I'd appreciate any ideas how to do this
            > >>
            > >>Thanks
            > >>
            > >>
            > >>
            > >>
            > >>[/color]
            > >
            > >
            > >[/color]
            >
            > --
            > Bas Cost Budde
            >[/color]


            Comment

            Working...