How to display data in a combo box with a query

vcarrill

Registered User.
Local time
Today, 09:26
Joined
Aug 22, 2019
Messages
61
I have the following form:
1748903174105.png

In this form the Dept is a combo box as well as Training in the subform. If I want to use a query to see who is solder certified as an example, what criteria would I enter in the query? I am able to see everything in Datasheet, but if I enter under training for example Like "std*", I do not get anything.

Here is my query: (Emp and Training tables are linked)
1748903544679.png



Thank you for the help!
 
I would expect a query the drives a combo to be based on a single table. What you want to achieve using a combo in this way is to set the Foreign Key field in the parent table. For example, if you have one employee, and many departments, and an employee can only belong to one department, and the employee table has a field called DepartmentID, then the query driving the combo on tEmployee.DepartmentID would look like...
SQL:
SELECT DepartmentID, Department FROM tDepartment ORDER BY Department;
• Departments don't know or care about Employees.
• One employee is bound to one department via table.field tEmployee.DepartmentID, which is what the combo selects and displays.
• Other important properties of this combo would be...
BoundColumn = 1 ' this is the value of the combo based on the underlying fields, and you want it to provide the DepartmentID
CoumnCount = 2 ' there are two columns in the query
ColumnWidths = 0";1" ' you want to hide the DepartmentID column, so the user only sees and selects from Departments by name.

• Similarly if you have a tEmployeeTraining table, there would be two foreign keys for each training record, EmployeeID and TrainingID. The combo on tEmployeeTraining.EmployeeID should present to the user employee names to choose from, so again based one table, and it should provide to the parent table record a valid EmployeeID.
• Same for a combo based on table tTraining which provides a valid TrainingID to tEmployeeTraining.TrainingID.

In respect to training and employees: In this relationship there should be three tables, 1) tEmployee which defines an obvious thing, 2) tTraining, which acts like a catalog of items that an employee might be trained in, and 3) tEmployeeTraining, which defines the relationship between 1) and 2). This table should store the date on which the training occurred, for instance, the level, the grade.
• tEmployee doesn't know or care about tTraining. There should be no data in the EE row about training.
• tTraining doesn't know or care about tEmployee. There should be no data in the training row about employees.
• tEmployeeTraining is the data definition for the real-world event of an employee being trained, so this row hasa PrimaryKey, and two ForeignKeys.

hth
 
I would start just by looking to see if you can find *std* in the training table all by itself.
If you have use Lookup fields, that is not going to happen in the emp table.
 

Users who are viewing this thread

Back
Top Bottom