Help on combo box please

jguillen

Registered User.
Local time
Today, 14:38
Joined
Dec 2, 2007
Messages
21
I need some help please, I have a form with the following fields:

Job#
Phase
Task#
Trade
Hours worked

I need to use a combo box for the task# from data filtered by a query using the values from the job# and phase. I build the expression for the parameters and I get no data.
If I use the data from the trade and job# it works fine!
For each Job there is several phases with tasks assign by trade, this data is in a separate table
This works fine
SELECT [Qry Rprt Tasks by Job test07].[Task #], [Qry Rprt Tasks by Job test07].Trade, [Qry Rprt Tasks by Job test07].[Job #]
FROM [Qry Rprt Tasks by Job test07]
WHERE ((([Qry Rprt Tasks by Job test07].Trade)=[Forms]![Timecard Data Entry Form]![Trade]) AND (([Qry Rprt Tasks by Job test07].[Job #])=[Forms]![Timecard Data Entry Form]![Job #]))
ORDER BY [Qry Rprt Tasks by Job test07].[Task #];

This will not.
SELECT [Qry Rprt Tasks by Job test07].Phase, [Qry Rprt Tasks by Job test07].[Task #], [Qry Rprt Tasks by Job test07].[Job #], [Qry Rprt Tasks by Job test07].Trade
FROM [Qry Rprt Tasks by Job test07]
WHERE ((([Qry Rprt Tasks by Job test07].Phase)=[Forms]![Timecard Data Entry Form]![Phase]) AND (([Qry Rprt Tasks by Job test07].[Job #])=[Forms]![Timecard Data Entry Form]![Job #]))
ORDER BY [Qry Rprt Tasks by Job test07].Phase;
 
I need to use a combo box for the task# from data filtered by a query using the values from the job# and phase.
First of all Guillen, a combo box's RowSource is essentially a query. So, most of the time you will not need to write a query to get the values you want to the combo box. You can simply write the SQL statement in the RowSource of the combo box control.

Second, I see nothing wrong with either of the following two statements...
Code:
SELECT [Qry Rprt Tasks by Job test07].[Task #], [Qry Rprt Tasks by Job test07].Trade, [Qry Rprt Tasks by Job test07].[Job #]
FROM [Qry Rprt Tasks by Job test07]
WHERE ((([Qry Rprt Tasks by Job test07].Trade)=[Forms]![Timecard Data Entry Form]![Trade]) AND (([Qry Rprt Tasks by Job test07].[Job #])=[Forms]![Timecard Data Entry Form]![Job #]))
ORDER BY [Qry Rprt Tasks by Job test07].[Task #];
Code:
SELECT [Qry Rprt Tasks by Job test07].Phase, [Qry Rprt Tasks by Job test07].[Task #], [Qry Rprt Tasks by Job test07].[Job #], [Qry Rprt Tasks by Job test07].Trade
FROM [Qry Rprt Tasks by Job test07]
WHERE ((([Qry Rprt Tasks by Job test07].Phase)=[Forms]![Timecard Data Entry Form]![Phase]) AND (([Qry Rprt Tasks by Job test07].[Job #])=[Forms]![Timecard Data Entry Form]![Job #]))
ORDER BY [Qry Rprt Tasks by Job test07].Phase;
...Therefore, whatever problem you are having is most likely associated with the form that is involved here.
 
But it wont work in a query either, I tried setting parameters in the query for the job# and phase values to be enter manually and ignores the phase input and only takes the value of the job#, and when I just put the parameter for the phase it ignores the parameter it will not even prompt it just executes the query unfiltered.
 
Your description is quite vague Guillen. Unless you can provide any more specific information, I would have to see a database to disect what's really going on here.
 
dbase attached

Here is dbase the form does not represent the change that I need to make in it.
I need to show the tasks for the phase and job so to limit the entry to only those tasks that correspond to that phase and job and to populate the trade field with the trade for that phase and task.

I realy appreciate you taking the time for this.



View attachment Task Schedule revised 12-11-07.zip
 
I have opened the file, and I assume the form I should be looking at is called "Tasks Data Entry Form"??

Is that correct?
 
yes, but the problem I see is, if you run the "query rpt task by job test07" and try to use a parameter in the phase to filter it does not work.
 
yes, but the problem I see is, if you run the "query rpt task by job test07" and try to use a parameter in the phase to filter it does not work.

A couple of things -

1. You should be using UNBOUND controls for your filtering.

2. You should NOT use special characters (for example #) in your object or field names. Get rid of them NOW while you still haven't gotten real far. Change it to emp_num or emp_no or EmpNo or EmpNum but do not use the # sign. It will only cause you major grief at some point. It is a special character with meaning in Access so using it will only confuse things. Check out this for special characters to not use:
http://support.microsoft.com/?id=826763

3. Get rid of embedded spaces within object or field names. It will simplify things for you when coding, etc.
 
Thank you Bob, I will change that in the tables, I did try to use an unbound field for the parameter for the phase and job in a test unbound form but it did not work I get no data when ever I try to use phase as a filter parameter.
 

Users who are viewing this thread

Back
Top Bottom