473,387 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Creating SQL query taking the field name from a text box

Hi, in MS Access I want to create a SQL query where field name can be taken from a text box or combobox. For example, I have a table name "bank" and it has fields "Customer_id","Cust_name","transaction". I want to display all transactions of customer "John". So I have two text boxes to provide the field name and the customer name. I want to make an SQL query to display the results but I don't want to provide the field/column name directly to the SQL command instead using text box. Can anyone help me please?

I don't want to write : SELECT Cust_name, transaction from bank where Cust_name = "John"

I want like : SELECT (text1.value),transaction from bank where (text1.value) = (text2.value)
May 7 '15 #1
3 1585
NeoPa
32,556 Expert Mod 16PB
SQL commands are basically strings.

Do you need specific instructions on how to work with strings or does that give you enough of a clue to get you going?
May 7 '15 #2
Well, I want to see that the SQL gives me the records of transaction matching with the name "John". So, later I can use other field name without changing the SQL command.
May 7 '15 #3
NeoPa
32,556 Expert Mod 16PB
I expect you do, but that doesn't answer my question. I'm ready to help but we need to converse sensibly for that to happen.
May 8 '15 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: ehm | last post by:
I am working on creating an editable grid (for use in adding, deleting, and editing rows back to an Oracle database). I have a JSP that posts back to a servlet, which in turns posts to a WebLogic...
3
by: Louis | last post by:
Is there a switch or a setting in Access so that a group by query doesn't return a field name SumOf(original field name)? Especially when you chain multiple queries together you'd get...
2
by: Ray | last post by:
I tried to change the field name in a query using "New Name: ". It did not work at all and just display the caption of the Field Name. Is it possible to change the field name or use a new caption...
2
by: LoopyNZ | last post by:
Hi, (Access 97) I'm creating a query (QRY_SUMMARY) to join a query (QRY) to itself (QRY_1). I'm returning QRY.* and selected fields from QRY_1. With each field (field_name) I return from...
18
by: NickName | last post by:
The following example may further clarify the question, Select fieldA, filedB, fieldC >From tblX Where fieldD = Forms!formName!controlName What I'd like to know is how to determine or get...
2
by: Bob Alston | last post by:
I have a database with user definable fields. These are in the table as Field1, Field2, etc. I store the labels in another place and on the form, I display the labels they designate instead of...
2
by: sandeepsandeep | last post by:
Hellow i am facing a problem in mysql query plesae solve it. I have a table Team_master with two field 1. team_id 2. team_name
11
by: captainphoenix | last post by:
In VB (.NET?) building a query from a table made in MS Access. I'm trying to type the sql line WHERE = @ but it won't recognize the code because "Course Number" is two words. the whole thing...
2
by: 1hok3 | last post by:
Hi! I want to use DlookUp(“Express”, Domain, Criteria) in my report. The problem is that, “Express” is a fixed , but I want the field name to be changed depending on the CONTENT in a Text Box I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.