Connecting Tech Pros Worldwide Help | Site Map

QUERY BASED ON TEXT BOX

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 06:40 PM
RICHARD BROMBERG
Guest
 
Posts: n/a
Default 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






  #2  
Old November 12th, 2005, 06:40 PM
Bas Cost Budde
Guest
 
Posts: n/a
Default 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

  #3  
Old November 12th, 2005, 06:40 PM
RICHARD BROMBERG
Guest
 
Posts: n/a
Default 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]


  #4  
Old November 12th, 2005, 06:40 PM
RICHARD BROMBERG
Guest
 
Posts: n/a
Default 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]


  #5  
Old November 12th, 2005, 06:40 PM
Bas Cost Budde
Guest
 
Posts: n/a
Default 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

  #6  
Old November 12th, 2005, 06:40 PM
Mike Storr
Guest
 
Posts: n/a
Default 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]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.