Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you set a query field name by a value in a combo box on a form?

Status
Not open for further replies.

Scoob55k

Technical User
Nov 16, 2005
62
US
Can you set a field name to what is selected in a combo box on a form? This would cut my queries and reports I need to make down to about 1 or 2 from 30 to 100 I figure.

Basically I have a table with 30 fields of information and I can get the use of a combo box, which lists all the table fields, using and Event Procedure to call the correct report out of the 30 individual fields. However the thing that is not very clean with all the queries & reports as well as very time consuming in creating a query/report for each field.

I've tried using
- Comments: DLookUp("Forms![frm Summary Reports]![Combo Report] ","tbl Survey Data"),
- Comments: [Forms]![frm Summary Reports]![Combo Report],
etc. to rename the field and get it to grab the specific data field, but it just ends up returning what is in the combo box.

I know there's a way and I am limited in my VBA coding as well as under the gun to complete this. Thanks for your efforts in adavnce!
 
And this ?
Comments: DLookUp([Forms]![frm Summary Reports]![Combo Report],"tbl Survey Data")

You may have to add a criteria in the DLookUp call ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

Thanks for that, however it brings up the first record only in the table and disregards other criteria set in the query. I tried to insert criteria shown below, however it did not return any data. Thanks!

Comments: DLookUp([Forms]![frm Summary Reports]![Combo Report],"tbl Survey Data","Left([ClaimNum],2) = '[Forms]![frm Summary Reports]![Combo Report]'")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top