Refreshing a tab on entry

deejay_totoro

Registered User.
Local time
Today, 06:48
Joined
May 29, 2003
Messages
169
Hello,

I have a form, with 3 tabs.

I would like the subform contained on tab 3 to be automatically updated when a user enters that tab (screen.)

How can I do this automatically? for example, I can put a refresh button on that subform, and it does indeed work. But how can I refresh the subform automatically upon entering this tab?

Thank you very much!

dj_T
 
Like this:

Code:
Private Sub MyTab_Change()
    If Me.MyTab = 2 Then
        Me.MySubForm.Requery
    End If
End Sub
 
Placement of code

Hello,

Thank you for the reply.

But, where do I place this code? For example, the tab itself only has the following:

On click
Dbl click
MouseDown
MouseMove
MouseUp

These events only occcur when the user performs an action on the actual subform. Where would I place the code so that it would run automatically?

Thank you very much.

dj_T
 
how about this solution?

Hello,

I did a search on "requery" and I came up with a soloution.

What I did was attach the following code to a save button on another subform, on another tab:

Forms!frmMyForm!subFrmMySubForm.Requery

It appears to work - when I click the save button it automatically updates the information on the other tab, so when the user enters, the data has already been refreshed.

Does this seem the correct way to do this?

Thanks!

dj_T
 
Re: Placement of code

deejay_totoro said:
Where do I place this code? For example, the tab itself only has the following:

On click
Dbl click
MouseDown
MouseMove
MouseUp

Reread my code - it's on the Tab's Change event.

If you only have those five events on your tab then you are either looking at the events of the Detail or a Page (within a Tab Control.)
 
I see!

Ah yes!

Found the on change!

Thanks for your help.

dj_t
 
Thanks for that answer - I was close, but just couldn't bring it together.
 

Users who are viewing this thread

Back
Top Bottom