473,396 Members | 2,029 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,396 software developers and data experts.

How to pass field name to query thru a form

I have a combo box on a form where i am having the list of fields from a table.
Now I want to pass the selected field name to a query.
Is it possible to do this?
Jan 10 '11 #1
1 1915
beacon
579 512MB
Hi Prashant,

In your query, in the Criteria section, type the following (where FieldName is the name of the combo box field on your form...you'll need to change this to the actual name you're using):

Expand|Select|Wrap|Line Numbers
  1. =[Forms]![frmYourFormName]![FieldName]
  2.  
Then, on your form, you'll need some way to launch the query. I would create a command button and add the following VBA in the OnClick event:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenQuery "YourQueryName"
  2.  
This will run the query and filter out all results that don't match up with the field name you're passing to the query through your form.
Jan 10 '11 #2

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

Similar topics

4
by: Stuart Palmer | last post by:
Hi everyone, I have a form with '/' in some of the field names, when I pass through to the next page the field name comes back as though it's been htmlencoded, so getting the value out of the...
7
by: Matt | last post by:
In ASP, when we pass data between pages, we usually pass by query string. If we pass data by query string, that means we need to use submit button, not by regular button, and the form will pass to...
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...
5
by: Bernard Davis | last post by:
Hi, I need to pass the value held in a field in one form and have it appear in another form. I specifically don't want to have to refer to the original form name as it has passed, because I...
6
by: DMUM via AccessMonster.com | last post by:
Hello I am trying to pass the name of my subform to a function/sub but I can't seem to get it to work. I am using an autokey function (ctrl E) to unlock text boxes on a subform. I have a few...
3
by: altafur | last post by:
hi, i am using java with hibernate . i want to run a hibernate order by query thru java. i have written the query in hibernate.hbm.xml file. the query is as follows: query: SELECT distinct...
2
by: Gogo | last post by:
I added a new field to an existing RPT. FORM shows #Name? in the new field. What did I do wrong. I need to tab to the field and put in new information.
9
by: Ledmark | last post by:
Hello - I've made a form with a subform of the same table, which is for Dr's notes. On the subform I have the query sorting in decending order and a criteria to enter a patient's name so the last...
3
by: coolminded | last post by:
hi all, can i pass field name of a table as a parameter in a function created in postgres, what i mean is i have one table :student with field names id name add. can i create a function...
3
by: Zarich | last post by:
Hello, i've been spending some time trying to figure out a solution for the hotlinking of the videos hosted at my site, which is imposible to do trough htaccess since firefox has a bug that can't...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.