Need to automate selection of a field in a query

ashraf999

New member
Local time
Today, 21:16
Joined
Mar 15, 2011
Messages
1
I have a query which has the following SQL:


SELECT [Complex Query 4].[EMP NO], [All Employees].[Practicing Manager], Employees.[Employee Name], [Master Table 2].[Project Manager], Sum([Complex Query 4].[Feb-11]) AS [SumOfFeb-11]
FROM (([Master Table 2] INNER JOIN Employees ON [Master Table 2].[EMP NO]=Employees.[EMP NO]) INNER JOIN [Complex Query 4] ON Employees.[EMP NO]=[Complex Query 4].[EMP NO]) INNER JOIN [All Employees] ON Employees.[EMP NO]=[All Employees].[EMP NO]
GROUP BY [Complex Query 4].[EMP NO], [All Employees].[Practicing Manager], Employees.[Employee Name], [Master Table 2].[Project Manager], Employees.Resigned, Employees.[Moved to Non-Banking]
HAVING (((Sum([Complex Query 4].[Feb-11])) Is Null) AND ((Employees.Resigned)=No) AND ((Employees.[Moved to Non-Banking])=No));

What I need is to be able to automatically select the month from a form and generate new results. According to the above query, the month is "Feb-11". So how would I be able to automatically generate the results if I wanted the month to be "Jan-11" without having to open the design of the query and change it manually?

Thanks
 
Welcome to the forum.

You can use a field on your form as the criteria in a query by using;
Code:
[Forms]![YourFormName]![YourFieldName]

That field might be a combo box from which the user selects a value or it might be a text box that the users enters a value.
 

Users who are viewing this thread

Back
Top Bottom