Refreshing Data Form in a Tab

C

Commish

OK, so, I've gotten lots of great help here. And I am finally getting
used to where everything is in the new Access.

I have my application working pretty well. Now I am using the forms
and doing some testing.

But... I have forms on Tab Controls. But, I am finding that the
information on the tab controls does not update as I enter the data on
the other forms. Hitting the refresh, or refresh buttons does not
work.

I have to close the whole form - and reopen it to get it to update the
data. That's not going to work. Do forms in tabs not refresh
automatically? If I add a Button with a form control set to refresh
form, that doesn't update the data.

Is there a fix?
 
J

John Spencer

Are you saving the data in the various forms? If you don't save the data then
the changes are not available to elsewhere in the database.

You need to force a save of the data and then refresh or requery the other forms.

PERHAPS you can use the forms' activate event to force a save of all the other
forms involved or the tab control's change event to do so.

Since you are using multiple forms on a tab control, I will assume that they
are subforms and you can use the change event of the tab control.

UNTESTED code follows

Private Sub TabCtLPages_Change()
Dim lUpDated as Long

If Me.subFormControlName1.Form.Dirty then
Me.SubForControlName1.Form.Dirty = False
lUpdated = 1
End IF

If Me.subFormControlName2.Form.Dirty then
Me.SubForControlName2.Form.Dirty = False
lUpdated = 2
End IF

If Me.subFormControlName3.Form.Dirty then
Me.SubForControlName3.Form.Dirty = False
lUpdated = 3
End IF

'Refresh any subforms that are dependent on the updated subform
Select Case lUpdated
Case 1
Me.subFormControlName3.Form.Requery
Case 2
Me.subFormControlName1.Form.Requery
Me.subFormControlName2.Form.Requery
Case 3
'Do nothing no dependent subforms
End Select

End Sub

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 

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