Forms, subforms and immediate update of totals

azgambit

Registered User.
Local time
Today, 19:33
Joined
Apr 11, 2002
Messages
28
I have looked and looked through the forums and while I found references to my issue, I was unable to locate a workable solution. Doesn't mean it isn't there, I just couldn't find it.

Here's what I have - I have a form named 'MainMenu'. 'MainMenu' is linked to a table named 'Pending' (this can't change). Embedded in the 'MainMenu' form is a subform named 'DataRecovery'. 'The form 'DataRecovery' is linked to a the table named 'DataRecovery'. The 'DataRecovery' table has a single number field.

On the 'DataRecovery' subform the only thing the user will do is enter a number representing how many times an action is performed and press a button that will save the record to the 'DataRecovery' table.

I need to place another object on the 'MainMenu' form that shows the total from the 'DatRecovery' table. I have managed to do this with a simple query; however, it will not do it immediately after a new record is entered. I have to exit and come back in before the total will update.

How can I get this object/query to update immediately on the 'MainMenu' form?

I would prefer to code this as opposed to a macro. If anyone can answer this one, please describe how to do using very small words :)
 
When the user presses the button to add another record you need to requery the sub-form containing the data. Use the Requery method of the subform.
 
Keith, I tried to use the Requiry and placed it in numerous locations.

Within the code associated with the 'Save record' button, but it wouldn't update.

Case you suggest the exact wording on the requiry?

I tried something along the lines of: Forms!MainMenu!DataRecovery.Form.Requery
and
DoCmd. Requery (as a part of the Save record button)

neither is immediately updating - I know I'm missing something simple
 
Is the save button on the main form? If so try Me.Requery
 
The Save button is located on the subform 'DataRecovery'.

Maybe I need to approach this from another direction. How about this:

How would I place a text box or some other object on the 'DataRecovery' subform that would show the results of the sum-query?

Right now, I have a second subform named 'DataRecoveryTotal' that presented the total from the sum-query.

Clear as mud?
 
It sounds to me you are requering the wrong subform. Try to requery DataRecoveryTotal subform because this is where the totals are contained, correct?
 
Sounds logical to me.

Would I place the requery in the code for the save button? And, if I am requering a subform from another subform, how would that be coded?

Would it be:
Forms!MainMenu!DataRecoveryTotal!form.Requery

or something different since the code is being run from the 'DataRecovery' subform and not the 'MainMenu' form?

And here I thought this was simple
 

Users who are viewing this thread

Back
Top Bottom