Form didn't get any update (1 Viewer)

Local time
Today, 20:11
Joined
Dec 18, 2021
Messages
46
Hi,

I created 2 tables 1,2. When creating a form related to table 1, and adding data to it, the table 1 is updated automatically. Also, when adding data directly in table 1, the form also updated without any problem.

When creating a form including the 2 tables, the tables updated automatically when adding data in the form.

The problem happened when adding data in the 2 tables directly. The form didn't get any update with the new entries. Can anyone tell me what's this weird problem?

Many thanks for any help.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 11:11
Joined
Aug 30, 2003
Messages
36,118
Have you closed/opened the form after adding data? It would need to be requeried to see data added outside of itself.
 

bastanu

AWF VIP
Local time
Today, 11:11
Joined
Apr 13, 2010
Messages
1,401
In addition to Paul's comment have you ensured that the PK\FK fields in the two tables (the join fields) are populated correctly?
 

bastanu

AWF VIP
Local time
Today, 11:11
Joined
Apr 13, 2010
Messages
1,401
Which seems like what I just said right :) ?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:11
Joined
Feb 19, 2002
Messages
42,971
If you are using a main form with a subform and you have properly set the master/child links, Access will automagically populate the FK value in the subform record when it is saved. Your description didn't say you were using main/sub forms but that is the ONLY way the FK would be populating without you actually doing something to make it happen.

This magic does not happen in when you update the tables directly. In fact, when you add a row to the second table, you should get an error if you have not properly populated the FK field. This assumes of course that you have properly define the relationship in the relationship window. So:
1. Did you define the relationship in the window? You should have
2. Did you enforce RI? You should have
3. Did you make the FK required? You should have
4. Did you change the default for the FK from 0 to null? You should have
5. And now we get to WHY are you bypassing the form to add rows to these tables? Because, if you do, YOU MUST supply the appropriate FK for every record that gets added to table2.
 
Local time
Today, 20:11
Joined
Dec 18, 2021
Messages
46
If you are using a main form with a subform and you have properly set the master/child links, Access will automagically populate the FK value in the subform record when it is saved. Your description didn't say you were using main/sub forms but that is the ONLY way the FK would be populating without you actually doing something to make it happen.

This magic does not happen in when you update the tables directly. In fact, when you add a row to the second table, you should get an error if you have not properly populated the FK field. This assumes of course that you have properly define the relationship in the relationship window. So:
1. Did you define the relationship in the window? You should have
2. Did you enforce RI? You should have
3. Did you make the FK required? You should have
4. Did you change the default for the FK from 0 to null? You should have
5. And now we get to WHY are you bypassing the form to add rows to these tables? Because, if you do, YOU MUST supply the appropriate FK for every record that gets added to table2.
Hi,
Your important notes inspired me to check the query. The problem was in line makes the form not updated automatically.
It was a complicated process but I successfully did it.
Thank you so much.
 

Users who are viewing this thread

Top Bottom