Refreshing Data on a subform

N

Neill M. Pinkney

Hi

I have a form frmA and two subforms on frm A - frmB where data is entered
and frmC which displays results of calculations based on values in text boxes
on frmA and frmB.

The refresh or requery on the underlying recordset I run on the On Exit
event of a text box on frmB isn't updating the totals on frmC. In addition to
the refresh & recordset requery I have tried issuing a "DoCmd.DoMenuItem
acFormBar, acRecordsMenu, 5, , acMenuVer70" to no avail.

However I do have a refresh button on frmA that runs "DoCmd.DoMenuItem
acFormBar, acRecordsMenu, 5, , acMenuVer70" twice and thus correctly displays
the calculations on frmC, but I want the screen to update automatically,
without user intervention. What am I doing wrong?

Any help would be greatly appreciated.
 
A

Allen Browne

On Exit of the text box is too early. The changes have not been saved at
that point.

Try using the AfterUpdate event of the *form* (not the control) to requery
(or recalc?) the other subform. Something like this:

Private Sub Form_AfterUpdate()
Me.Parent.[NameOfYourOtherSubformHere].Form.Requery
End Sub

Use the Requery if you need to get your other subform to reload its data
from its table, or the Recalc if you are trying to update calculated
controls on the other subform. (Calculated controls are those where the
Control Source property starts with an equal sign.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top