Subform requery..?

K

Kent Johnson

Hi all,

I have a tabcontrol on a form and I would like my SubForm to be requery when
I click on a tab.
Something like:
=========================
Sub Tab_click
Forms!MainForm![SubForm].Requery
End Sub
=========================
I have tried this but nothing happens- not even a errormessage.

/Kent J.
 
G

Guest

Try this:
Me.NameOfYourSubFormControl.Form.Requery

You must put the name of the control that contains the subform.

Ray
 
K

Kent Johnson

Ray,

Sorry, I don't get it.
<<..control that contains the subform>>
Is it not the MainForm that contains the Subform?
I have put the Subform in the Detail section on the MainForm
NameOfYourSubFormControl: is that, i my case, refeering to the Detail
section on the Mainform?

/Kent J.


Ray Cacciatore said:
Try this:
Me.NameOfYourSubFormControl.Form.Requery

You must put the name of the control that contains the subform.

Ray

Kent Johnson said:
Hi all,

I have a tabcontrol on a form and I would like my SubForm to be requery when
I click on a tab.
Something like:
=========================
Sub Tab_click
Forms!MainForm![SubForm].Requery
End Sub
=========================
I have tried this but nothing happens- not even a errormessage.

/Kent J.
 
G

Guest

Yes, the Main form does contain the subform but what I really mean is the
control that represents the subform inside the detail section. In other
words, when you added the subform to the detail section, Access added a
"placeholder" control in your detail section. When you click once on this
control and open the properties window, you'll see the name of this control.
By default, Access gives it the name of the subform itself. But sometimes
people change it and things don't work.

Ray

Kent Johnson said:
Ray,

Sorry, I don't get it.
<<..control that contains the subform>>
Is it not the MainForm that contains the Subform?
I have put the Subform in the Detail section on the MainForm
NameOfYourSubFormControl: is that, i my case, refeering to the Detail
section on the Mainform?

/Kent J.


Ray Cacciatore said:
Try this:
Me.NameOfYourSubFormControl.Form.Requery

You must put the name of the control that contains the subform.

Ray

Kent Johnson said:
Hi all,

I have a tabcontrol on a form and I would like my SubForm to be requery when
I click on a tab.
Something like:
=========================
Sub Tab_click
Forms!MainForm![SubForm].Requery
End Sub
=========================
I have tried this but nothing happens- not even a errormessage.

/Kent J.
 
K

Kent Johnson

Ray,

This one works!
=====================
Private Sub CmbLand_AfterUpdate()
Me.MySubform.Form.Requery
End Sub
=====================

This one doesn't!
=======================
Private Sub TabPage1_Click()
Me.MySubform.Form.Requery
End Sub
========================

Why can't I run the requery command from the TabControl?

/Kent J.


Ray Cacciatore said:
Yes, the Main form does contain the subform but what I really mean is the
control that represents the subform inside the detail section. In other
words, when you added the subform to the detail section, Access added a
"placeholder" control in your detail section. When you click once on this
control and open the properties window, you'll see the name of this control.
By default, Access gives it the name of the subform itself. But sometimes
people change it and things don't work.

Ray

Kent Johnson said:
Ray,

Sorry, I don't get it.
<<..control that contains the subform>>
Is it not the MainForm that contains the Subform?
I have put the Subform in the Detail section on the MainForm
NameOfYourSubFormControl: is that, i my case, refeering to the Detail
section on the Mainform?

/Kent J.


Try this:
Me.NameOfYourSubFormControl.Form.Requery

You must put the name of the control that contains the subform.

Ray

:

Hi all,

I have a tabcontrol on a form and I would like my SubForm to be
requery
when
I click on a tab.
Something like:
=========================
Sub Tab_click
Forms!MainForm![SubForm].Requery
End Sub
=========================
I have tried this but nothing happens- not even a errormessage.

/Kent J.
 
G

Guest

The "tab" that you click on to change Tab Pages is not considered part of the
Tab Page so it doesn't fire the page's Click event.

If you want an event that fires when you change Tab Pages then you have to
use the Change event of the TabControl. To make that code "page specific"
you test the value property of the TabControl in the change event to
determine which page was just selected and run your code accordingly.

For example:

Private Sub MyTabControl_Change()

Select Case MyTabControl
Case MyFirstTab.Pageindex
'/// Code that executes when user clicks the first tab
Case MySecondTab.PageIndex
'/// Code that executes when user clicks the second tab

End Sub

Kent Johnson said:
Ray,

This one works!
=====================
Private Sub CmbLand_AfterUpdate()
Me.MySubform.Form.Requery
End Sub
=====================

This one doesn't!
=======================
Private Sub TabPage1_Click()
Me.MySubform.Form.Requery
End Sub
========================

Why can't I run the requery command from the TabControl?

/Kent J.


Ray Cacciatore said:
Yes, the Main form does contain the subform but what I really mean is the
control that represents the subform inside the detail section. In other
words, when you added the subform to the detail section, Access added a
"placeholder" control in your detail section. When you click once on this
control and open the properties window, you'll see the name of this control.
By default, Access gives it the name of the subform itself. But sometimes
people change it and things don't work.

Ray

Kent Johnson said:
Ray,

Sorry, I don't get it.
<<..control that contains the subform>>
Is it not the MainForm that contains the Subform?
I have put the Subform in the Detail section on the MainForm
NameOfYourSubFormControl: is that, i my case, refeering to the Detail
section on the Mainform?

/Kent J.


Try this:
Me.NameOfYourSubFormControl.Form.Requery

You must put the name of the control that contains the subform.

Ray

:

Hi all,

I have a tabcontrol on a form and I would like my SubForm to be requery
when
I click on a tab.
Something like:
=========================
Sub Tab_click
Forms!MainForm![SubForm].Requery
End Sub
=========================
I have tried this but nothing happens- not even a errormessage.

/Kent J.
 

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