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

Need some help with parameter queries and comboboxes..

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi. I am having difficulties with using comboboxes with a parameter query. I'll explain the situation:

I have a data-entry form (and a corresponding table, of course) that is used to enter project information.

In the form, there is a combobox to select the employees name. This combobox is based on a query which takes the employees last, first and middle names and concatonates them so they will appear as full names in the combobox(for eg. Smith, Jason A.)

This full name format is the same format that I would like for a combobox on a form that is used for a parameter query. I am not sure how the parameter query goes about getting information from the combobox. So, inturn, I am having difficulty using the original fullname query as a source for the combobox and then getting the selected information from the combobox into the criteria box of the parameter query I would like to make.

That's my first problem. Now for my second:

Company projects may take several years and hence require several years of funding. In the project table, there are columns for each year of financing that a project receives (for eg. 2000/2001; 2004/2005; etc. into each of these columns are entered dollar amounts). I would like to do a query to see how much funding a particular employee is getting in any given financial year.

How do I get the query to just pick info out of just one year's column (for eg. I will pick Smith, Henry A. from the employee combo box and 2001/2002 from the year combobox and have the query show all of the funding that Henry Smith will receive during 2001/2002)?

Any help on this will be greatly appreciated.
 
I had the same question about combo boxes for parameter queries. Look up thread #10965. Several people answered with a variety of help. Larry got me the farthest and helped me solve the problem. [sig][/sig]
 
First question:
Open your form and find your comobox, Double click on it in design view and Note its name 'Combo31' or whatever.
Then view your form in normal mode so you can see records in it.
One problem I see with that is you have 3 fields, last name, Middle, and first name.
So in order to find (Smith, Jason A.) your query has to break apart the name to find 'Smith' in the lastname field, 'Jason' in the first name field and 'A' in the middle.

So I would have a comob box that has 3 fields instead of concateneting them together.
Next you have to add a unique ID field to all the records
you can simply add a Autonumber field and after you save the table again it will give each person a unique ID
Now when you click the combobox have the query look at the unique ID in the combobox which can be hidden

Here is a example I made for you
SELECT ID, [Last name], [first name], middle
FROM Owner
WHERE (((ID)=[Forms]![Form2]![Combo0]));

the combobox on my form is Combo0

Here is the Row source for that combobox:
SELECT DISTINCTROW ID, [Last name], [first name], middle FROM Owner ORDER BY [Last name], [first name], middle;
[sig]<p>DougP, MCP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top