Update or Requery button

azhar2006

Registered User.
Local time
Today, 08:36
Joined
Feb 8, 2012
Messages
297
Hello everyone
I am trying to add an update button after adding data to a subform. But I want the place or location of this button in the main form
 
The code depends on the name of your subform control. It might be something like

Code:
Me.[your subform].Form.Requery
 
what do you need to Update?
 
But I want the place or location of this button in the main form
That won't work.

Why?
Because Access automagically saves the subform record when you move focus from the subform to any control on the main form so by the time your code in the mainform runs, the data from the subform has already been saved.

So, the question becomes what are you trying to do or prevent that you can't just let Access automatically save or don't want to put the save button on the subform?
 
That won't work.

Why?
Because Access automagically saves the subform record when you move focus from the subform to any control on the main form so by the time your code in the mainform runs, the data from the subform has already been saved.

So, the question becomes what are you trying to do or prevent that you can't just let Access automatically save or don't want to put the save button on the subform?
Thanks a lot for the reply
I know. Access saves the data as soon as you move to the next field. What I want is to refresh the form because there is an unstructured field where the sum of records is calculated and another field that calculates the sum of vacation days. I can't see that unless I close and open the form or go back in the records.
 
Thanks a lot for the reply
I know. Access saves the data as soon as you move to the next field. What I want is to refresh the form because there is an unstructured field where the sum of records is calculated and another field that calculates the sum of vacation days. I can't see that unless I close and open the form or go back in the records.
So, did the suggested code work or not?
 
What does ‘didn’t work’ mean? You get an error? Nothing happens?

Where are the two calculated controls? Main form or subform? What is the controlsource to these two controls?
 
What I want is to refresh the form because there is an unstructured field where the sum of records is calculated and another field that calculates the sum of vacation days. I can't see that unless I close and open the form or go back in the records.
Try this code for your button.
Code:
Me.Recalc
 
Thanks a lot for the reply
I know. Access saves the data as soon as you move to the next field. What I want is to refresh the form because there is an unstructured field where the sum of records is calculated and another field that calculates the sum of vacation days. I can't see that unless I close and open the form or go back in the records.
Why couldn’t you mention your requirements in your first post?
 

Users who are viewing this thread

Back
Top Bottom