Connecting Tech Pros Worldwide Forums | Help | Site Map

QUERY BASED ON TEXT BOX

RICHARD BROMBERG
Guest
 
Posts: n/a
#1: Nov 12 '05
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
Guest
 
Posts: n/a
#2: Nov 12 '05

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

RICHARD BROMBERG
Guest
 
Posts: n/a
#3: Nov 12 '05

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@worldnet.att.net> wrote in message
news:8F8Sb.134747$6y6.2621079@bgtnsc05-news.ops.worldnet.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]


RICHARD BROMBERG
Guest
 
Posts: n/a
#4: Nov 12 '05

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]


Bas Cost Budde
Guest
 
Posts: n/a
#5: Nov 12 '05

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@worldnet.att.net> wrote in message
> news:8F8Sb.134747$6y6.2621079@bgtnsc05-news.ops.worldnet.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

Mike Storr
Guest
 
Posts: n/a
#6: Nov 12 '05

re: QUERY BASED ON TEXT BOX


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

Mike Storr
www.veraccess.com



"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@worldnet.att.net> wrote in message
> > news:8F8Sb.134747$6y6.2621079@bgtnsc05-news.ops.worldnet.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]


Closed Thread