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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reports

Status
Not open for further replies.

Kamille

Technical User
Oct 27, 2003
15
0
0
CA
Hello "Help-WORLD"
Hope you can help me solve this.

On a form I have a combo box containing about 100 company names.

Scenario:
A user opens the form selects a company name from the drop down list and then clicks a preview report command button which should then open up a report for THAT company that was selected by the user.

Problem:
How do I have the report feed in the value selected by the user so that it displays a report on that particular value?

My report runs a query which basically accesses info. from two tables to display information such as company name, num of employees, Main product.

I need to figure out a way so that when the user selects a value from the combo box my query will compare that value and display the info pertaining to that particular company.

Any suggestions?



 
You could base your report on a parameter query. Set the Company field to be the parameter and set it to take that parameter(value) from the combobox you already have. Then you create a command button on the same form as your combobox and set it to trigger the report on click.

Jaydeebe
 
Thanks for the suggestion. I do have a parameter query set up as a record source for my report but I don't know how to automatically set the combo box value as the parameter without having a pop up message box appearing asking for the company name. How do I autofeed the combo box value that the user selects as the value to the parameter?

Thanks!
Kamille
 
In the criteria on the field in the query add:

[forms]![Your Form Name]![cboBoxName]
 
Thanks for all the tips I appreciate it.

I tried that but it is still not working the report is blank. If I add a text box instead of a combo box and type in the name of the company, it works for:
[Forms]![Form Name]![text36]
but for some reason if I have a combo box and I write:
[Forms]![Form Name]![Combo34] it doesn't work at all.

Does Access not allow this type of auto parameter feed for combo boxes?

Thanks,
Kamal!
 
It definately allows you to use the combo box as criteria - I do it all of the time. Perhaps it has to do with the fact that you have two tables in the query - Try taking out the criteria from your query - Create another query based on your first query and enter the criter into the second query.

HTH - Fred
 
Make sure the criteria in your query is asking for the bound column of the combo box. One nice thing about Access is that you can display one value in the combo box while having it actually store another.

For example, the source of my combo box is:

Select Field1, Field2, Field3 FROM Table1

and my bound column is set to 2 then the information in field2 is actually being stored (in a table or for use later). Now, if my field sizes are set to 1";0";0 then Field1 is going to be displayed.
 
THANKS SO MUCH!
I had "Select Field1, Field2, Field3 FROM Table1"

However my Bound Column was set wrong, it was set to 1 but needed to be set to 2 so I can access Field 2.

This helps so much,
Thanks Again!
Kamille!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top