Subform doesn't update after values being updated by another form

razovsuki

Registered User.
Local time
Today, 23:09
Joined
Feb 17, 2015
Messages
17
Hi,

I'm running into an issue with my forms.
I have a form that contains a subform, that contains a list of projects. This list is read-only. To update a record, you can double click on it, which opens another form filtered on this record, and which contains the fields in the first form as well as some others.
I have a command button on that last form to "Save and close", which fires up a macro that saves the record and closes the window.

Now, the issue that I'm having is that, when the window closes and I'm once again in front of the first form with the list of projects, the values of the record I changed are not updated and when I click on another record, Access tells me there's a conflict in the values and asks me if I want to keep the changes, discard them or copy to the clipboard.
It seems to consider the old values from the first form as a change, and thus asks me which to keep between these, and the actual (proper) changes I made in the dedicated form.
For the proper changes to be applied, I need to select "Drop changes".

I tried to requery the first form, also undo the changes to it after closing the window, but none of that worked.

Do you have any idea why it would do that?

I'm actually basing this on one of the templates, which does exactly what I want and which obviously works...
 
Possible solutions:
1) When you open the form to modify the record, close the main form (the one with the subforms). Then when you close the modify form, open the main one. This will cause the main one to open with the newer value.
2) Don't use tables as the recordsource for the subforms. Change the recordsource for the sub forms to queries, which should accept the new values.
3) if you keep the main form open, the last command before you close the mod form is me.refresh, which refreshes the table with the changes you made. Then the main form should display the new values.
4) One last thing, if you have a mod form, it tells me you can't edit anything on the main form. So make sure the record locking on the main form is set to "No Locks" and on the mod form, "Record Only".
Hope that helps
 
Hi Privateer,

Thanks a lot for the help.
I tried all the solutions you mentioned, and unfortunately, none of them worked.
The good news is though that one of your suggestions led me to the answer to my problem:
What I did (and how it was set in the template as well, which I hadn't noticed) is use a Refresh but on the main form's subform, BEFORE opening the mod form.
So, when I double click a record in the main form's subform, I use Refresh and only then I call openForm. Then, if I make a change in the mod form and use my "Save and Close" button, the changes appear correctly on the main form's subform.
I'm not sure why it works like that, but it does, so I'm not going to complain :)

Thanks again for the help!
 
You're welcome and I am glad you got it working.
 

Users who are viewing this thread

Back
Top Bottom