last day (14 days later) » 

1:08 PM
0
A: MS Access, create a relationship with a form and subform

asdevYour 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...

 
I tried to mess around with the link child and master field commands a bit earlier, but to no avail. I think the problem may have to do with the where statement in my code, perhaps i referred to the text box incorrectly..?
 
Good point. Maybe you can try: Forms![Navigation Form]![student id] With the link child and master field: Do a tutorial to understand the mechanics. It will simplify a lot of thing. Or just use the subform wizard
 
Doesn't seem to work. Also this subform i have already was made with the wizard
 
Okay, basically, if the student ID appears it must be a valid query. It is not so easy debugging this from here, so I can only give you a hint: Try your query with the query designer and show it on the query datasheet when the form is open. There you can change the query and designer as often as you want until you have the right query
 
When i try running my query NOT in the form but directly from the place where i write the query itself, i get no results returned. I think this suggests that i am in fact writing the wrong query?
 
1:08 PM
Probably! BTW: If you have linked the subform with the parent form with the wizard as described, you do not need a WHERE Statement in your query for the subform!
 
By taking out the where statement, the exact same result is achieved. So i think i have to do this without linking them somehow, but i cant figure it out. I still think it has to do with the where clause but everything i've tried has either shown all results or none of them.
 
Maybe there is no data in the fields in the subform. Without the Where statement and with linked fields enabled: Have you tried to input data and watch it again? I am sorry for stating that, but a linked subform is really basic Access, supported by wizard, and I suggest you to watch at least a Youtube Tutorial about that topic
 
I've watched numerous tutorials but the issue is that i can't find one on the simple topic of displaying different data depending on what record is currently selected. And while inputting data, i realised that it in fact seemingly is holding NO data. I'm not sure why, since I've linked them to one another...
 
I followed that video to the T and I ran into the exact same problem, it displays only the ID... im really confused about this @.@
 
1:09 PM
Just remove the whole subform and add a new one.
Or build a subform in a testdatabase from scratch
 
I removed it and added a new one when following the tutorial
 
Did you set a query to thge subform?
 
I think i didnt have to use a query when i did it the way in the tutorial
I'll quickly make another one
oh wait, what i just said was ridiculous, of course i set a query
 
the import question is: When you enter data, (save it) close, open form and move back to the main recordset. Is the entered data there or not?
 
Yes, it saves itself in the database in the table that i set it to
 
1:14 PM
But you cannot see it in the subform?
when you reopen it?
 
it is there when i close and reopen
 
then it is okay!
Isn't this what you wanted?
 
I mean data the I input into the subform is there
existing data is not
i want the existing data regarding the 'subjects' to display based on what record is present above on the (non-subform) form
 
Do you have a field in the existing data, where you reference to the one in the main table?
 
they are linked by the field "student ID" which is in both tables, if that's what you mean
 
1:18 PM
Are those two tables?
and wich of them is the main and which is sub?
 
Student ID is a field which appears in the tables "Student Details" (the main table) and "Student Subjects" (the sub)
 
Thats all right
The problem might be, that the existing table "Student subjects" has the wrong entry or no entry in its studentID
if it is so, your data is messed up!
 
It seems that you're right
i just checked through my data (there are thousands of entries >.>)
and i couldn't find one of the ID numbers
(i used ctrl+F)
 
Where is this data from?
how did you enter it?
And why is the reference away?
Did you remove the auto value of the primary key?
 
It's a School assignment, data given to me by a teacher
We aren't allowed to change the data unfortunately
not to mention that our teacher hasn't taught us any SQL or VBA yet so it's a bit of a struggle haha
im not sure what you mean by 'why is the reference away'
Although, i think that the reason there are missing entries is because the students without 'subjects' are younger students
 
1:25 PM
This is strange. If it is homework, there must be something else
 
i just checked again, students that are older have entries
 
If it is an assignment, that has not been done by anyone yet. The data is probably messed up
 
I'll have to ask my teacher about it in that case, thankyou for all your help!
 
You can set "referential integrity" to the tablefields, so it is not possible to have entrys
in a subtable without a corresponding entry in main table
 
what do you mean by not possible to have entrys?
 
1:28 PM
wasnot done writing ;)
 
ah haha
is referential integrity in the property sheet?
 
No, watch the youtube video again in T ~
T~1.00 min
 
there you can see where to set the relationship
 
Also, after clicking through about 500 entries i reached one that had proper data (the student was older)
 
1:31 PM
or google: set relational integrity in ACCESS
 
ahh yes, i already did that :D
 
You can use a SQL statement to find out, which entrys in sub table do not have a entry in main table. Look in Stackoverflow for the syntax
I have to leave now. Good luck
 
thankyou so much for your help :D
 

last day (14 days later) »