简体   繁体   中英

SubForm exclusions Microsoft Access

I have a practice database I'm developing in order to become familiar with access. I have created 3 tables, Employees, Computers and Warranty. In the Employee Table there is an Eid (PK), First Name, Last Name and Location. In the computer table there is an Eid(FK), Serial Number (PK) and various identifiers such as brand, size,etc.

Problem I want the form to show only the employees who currently have a device followed by the devices they have displayed in a subform. *see below

Employee Rachel Downs Devices Dell Latitude Apple iPad

Instead I get the following result

If I choose sort by employee with a subform, each employee is displayed with the devices they own. Including employees who don't have any devices. I only want to display employees who currently have devices assigned. Any suggestions on how to do this? fyi I used the form wizard to create the forms.

In the parent form invoke the query builder on the recordsource. You'll need to write a query that joins on Employees and Computers and then groups on Employee.

SELECT Employees.Eid
FROM Employees INNER JOIN Computers ON Employees.Eid = Computers.Eid
GROUP BY Employees.Eid

You can add other fields as needed from the Employees table just make sure to group on them as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM