By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,234 Members | 1,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,234 IT Pros & Developers. It's quick & easy.

QUERY BASED ON TEXT BOX

P: n/a
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

Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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:
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

Nov 12 '05 #2

P: n/a
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" <di******@worldnet.att.net> wrote in message
news:8F**********************@bgtnsc05-news.ops.worldnet.att.net...
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


Nov 12 '05 #3

P: n/a
I am porting the application from something written in Dbase IV and don't
have much flexibility in file/table layouts.
"Bas Cost Budde" <ba*@heuveltop.org> wrote in message
news:bv**********@news2.solcon.nl...
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:
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

Nov 12 '05 #4

P: n/a
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:
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" <di******@worldnet.att.net> wrote in message
news:8F**********************@bgtnsc05-news.ops.worldnet.att.net...
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

Nov 12 '05 #5

P: n/a
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" <ba*@heuveltop.org> wrote in message
news:bv**********@news2.solcon.nl...
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:
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" <di******@worldnet.att.net> wrote in message
news:8F**********************@bgtnsc05-news.ops.worldnet.att.net...
I am using MS Access 2000 and crating an application where the main tablehas about 90 fields.
I understand how to run a where the value of a PARTICULAR field is enteredinto 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

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.