简体   繁体   中英

MS Access, create a relationship with a form and subform

So, my problem is that i have a form like so:

在此处输入图片说明

this screen is located inside a navigation form and is called "Student Details"

I created a query with the following code and turned said query into a subform:

SELECT [student subjects].[student id],[student subjects].[Subject Code], [student subjects].[Class Number], [student subjects].Result
FROM [student subjects]
WHERE [student subjects].[student id] = Forms![Navigation Form].Form![student id];

Essentially, what i want to happen is for the subject code, class number and results of a student to appear in the subform below; so i thought i would go about this by stating that the student IDs must be the same.

Some more information, the information at the top of the image is in a different table from the information in the subform.

However, as you can see, the subform only replicates the student ID and not the other fields. I would like to rectify this.

Thanks in advance.

Your code is correct. Maybe the columns you selected are empty or not saved yet.

BTW: there are properties for the subform where you can relate to the parent form. I think the english property name is Link Child Field and Link Master Field Just put the fieldname of your Ids in there.

EDIT

See also here

https://support.office.com/en-us/article/Create-a-form-that-contains-a-subform-a-one-to-many-form-ddf3822f-8aba-49cb-831a-1e74d6f5f06b?rs=en-US&ui=en-US&ad=US

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