Forms used to run query

A

Arlene

I created a form from where the information is selected to run the query. The
problem is that I want to pull information from two different columns inthe
query.

In other words, I have a query that pulls information from 5 differente
tables. I need to query the info by building/department and by full name
column. I created a form from where the user can select the building to run
the query, but I also want to get the employees full name, only employees
located in that building so that I can run a report based on that employee. I
hope I make sense! :) Any help would be greatly appreciate it.
 
K

KARL DEWEY

I hope I make sense!
Yeah, but you did not post the SQL of your query so others could suggest
changes.
 
A

Arlene

On the query I have the following:

[Forms]![FrmSelectInfoforPosting]![SelectYourBuilding]

[Forms]![FrmSelectInfoforPosting]![SelectEmployee]
 
J

John W. Vinson

On the query I have the following:

[Forms]![FrmSelectInfoforPosting]![SelectYourBuilding]

[Forms]![FrmSelectInfoforPosting]![SelectEmployee]

What Karl's asking is to see the entire query. To post it here, open the query
in design view, and choose View... SQL on the menu. Copy and paste the SQL
text to a message here. It may also help to describe the structure of your
table(s), if that isn't obvious.
 
A

Arlene

It is a large query, but here it is:

SELECT tblposition.PositionID, tblposition.JobClassification,
tblposition.UnitClassification, tblposition.PositionCode,
tblposition.PositionDescription, tblposition.PositionFTE,
tblposition.HoursPerDay, tblposition.DaysPerYear,
tblBuildingPosition.BuildingPositionFTE, tblBuildingPosition.PositionStatus,
tblBuildingPositionBudget.BudgetCodeFTE, tblEmployee.EmployeeId,
tblEmployee.SSN, tblEmployee.LastName, tblEmployee.FirstName,
tblEmployee.MiddleName, tblBuildingPositionBudget.BudgetCodeID,
tblBudgetCode.Fund, tblBudgetCode.Function, tblBudgetCode.Object,
tblBudgetCode.Funding, tblBudgetCode.InstructionalUnit,
tblBudgetCode.Building, tblBudgetCode.Subject, tblBudgetCode.JobClass,
tblBudgetCode.CostCenter, tblBuildingPosition.Building
FROM tblposition INNER JOIN (tblEmployee INNER JOIN (tblBuildingPosition
INNER JOIN (tblBuildingPositionBudget INNER JOIN tblBudgetCode ON
tblBuildingPositionBudget.BudgetCodeID = tblBudgetCode.BudgetCodeID) ON
tblBuildingPosition.BuildingPositionID =
tblBuildingPositionBudget.BuildingPositionID) ON tblEmployee.EmployeeId =
tblBuildingPosition.EmployeeID) ON tblposition.PositionID =
tblBuildingPosition.PositionID;

I am using all of this information on a report, but what I need is that the
user choose their building and then select the employee in their building.


John W. Vinson said:
On the query I have the following:

[Forms]![FrmSelectInfoforPosting]![SelectYourBuilding]

[Forms]![FrmSelectInfoforPosting]![SelectEmployee]

What Karl's asking is to see the entire query. To post it here, open the query
in design view, and choose View... SQL on the menu. Copy and paste the SQL
text to a message here. It may also help to describe the structure of your
table(s), if that isn't obvious.
 
J

John W. Vinson

I created a form from where the information is selected to run the query. The
problem is that I want to pull information from two different columns inthe
query.

In other words, I have a query that pulls information from 5 differente
tables. I need to query the info by building/department and by full name
column. I created a form from where the user can select the building to run
the query, but I also want to get the employees full name, only employees
located in that building so that I can run a report based on that employee. I
hope I make sense! :) Any help would be greatly appreciate it.

It sounds like what you need is a "conditional combo box". On your form you
have two combo boxes; I'll call the form frmFind and the combo boxes
cboBuilding and cboEmployee (you use your own names of course!)

Base cboEmployee on a Query referencing the building combo box as a criterion:

=[Forms]![frmFind]![cboBuilding]

Also, Requery cboEmployee in the AfterUpdate event of cboBuilding.

This will let you select a building; once you have done so the combo box for
employees will show only those employees in that building. Either or both
combo boxes can then be used as criteria in the Report's recordsource.
 
A

Arlene

Thank you so much!!!!

John W. Vinson said:
I created a form from where the information is selected to run the query. The
problem is that I want to pull information from two different columns inthe
query.

In other words, I have a query that pulls information from 5 differente
tables. I need to query the info by building/department and by full name
column. I created a form from where the user can select the building to run
the query, but I also want to get the employees full name, only employees
located in that building so that I can run a report based on that employee. I
hope I make sense! :) Any help would be greatly appreciate it.

It sounds like what you need is a "conditional combo box". On your form you
have two combo boxes; I'll call the form frmFind and the combo boxes
cboBuilding and cboEmployee (you use your own names of course!)

Base cboEmployee on a Query referencing the building combo box as a criterion:

=[Forms]![frmFind]![cboBuilding]

Also, Requery cboEmployee in the AfterUpdate event of cboBuilding.

This will let you select a building; once you have done so the combo box for
employees will show only those employees in that building. Either or both
combo boxes can then be used as criteria in the Report's recordsource.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top