Requery diagram on subform..?

K

Kent J

Hi all,

I have diagram on a subform and I want the diagram to be updated when I
click on the Tab. Something like:
========================================
Private Sub Diagram_1_Click()
Forms![FrmGrund1]![FrmDiagram].Requery
End Sub
========================================

What have I missed?

Kent J.
 
J

Jeanette Cunningham

Hi Kent,
is the form with the diagram on a tab control?
Tab controls have an event called the Change event.
Assume you have a tab control called tabOrders with 2 pages
Assume that frmDiagram is on the 2nd page of tabOrders.
Assume that FrmDiagram is the name of the subform control and that
FrmDiagram is the name of the form inside the subform control.
Note: the name of the subform control is not always the same as the name of
the form inside the subform control.
To refer to a control on a subform you need to use syntax like this:
Forms![MainFormName]!Form.[NameOfControlOnSubformInsideSubformControl]

You would use code something like this:

Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Forms![FrmGrund1]!form.[FrmDiagram].Requery
End If
End Sub

If the tab control is on the 1st page, tabOrders has a value of 0.
If the tab control in on the 2nd page, tabOrders has a value of 1.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
K

Kent J

Hi,
Thanks for your reply!
<<..is the form with the diagram on a tab control?>>
Yes, it is.

<<tab control called tabOrders>> - yes
<<FrmDiagram is the name of the subform control>> - yes
<<FrmDiagram is the name of the form inside the subform control>> - yes

If I run:
=============================================
Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Forms![FrmGrund1]!Form.[FrmDiagram].Requery
End If
End Sub
=============================================
...I'll get "Can't find field 'Form'" error 2465

Kent J.




Jeanette Cunningham skrev:
Hi Kent,
is the form with the diagram on a tab control?
Tab controls have an event called the Change event.
Assume you have a tab control called tabOrders with 2 pages
Assume that frmDiagram is on the 2nd page of tabOrders.
Assume that FrmDiagram is the name of the subform control and that
FrmDiagram is the name of the form inside the subform control.
Note: the name of the subform control is not always the same as the name of
the form inside the subform control.
To refer to a control on a subform you need to use syntax like this:
Forms![MainFormName]!Form.[NameOfControlOnSubformInsideSubformControl]

You would use code something like this:

Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Forms![FrmGrund1]!form.[FrmDiagram].Requery
End If
End Sub

If the tab control is on the 1st page, tabOrders has a value of 0.
If the tab control in on the 2nd page, tabOrders has a value of 1.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Kent J said:
Hi all,

I have diagram on a subform and I want the diagram to be updated when I
click on the Tab. Something like:
========================================
Private Sub Diagram_1_Click()
Forms![FrmGrund1]![FrmDiagram].Requery
End Sub
========================================

What have I missed?

Kent J.
 
J

Jeanette Cunningham

My mistake

Forms![FrmGrund1]!Form.[FrmDiagram].Requery
this should be

Forms![FrmGrund1]![FrmDiagram].Form.Requery

The .Form needs to be after the name of the subform control, not before it.

The other point relates to forms and tab controls.
When a tab control is on the main form, you don't need to use the construct
Forms![FrmGrund1]

Instead use Me

So the code becomes
Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Me.[FrmDiagram].Form.Requery
End If
End Sub

Make sure you use the correct value of the tab control.
If on the 1st page the tab control has a value of 0
If on the 2nd page, the tab control has a value of 1 and so on


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Kent J said:
Hi,
Thanks for your reply!
<<..is the form with the diagram on a tab control?>>
Yes, it is.

<<tab control called tabOrders>> - yes
<<FrmDiagram is the name of the subform control>> - yes
<<FrmDiagram is the name of the form inside the subform control>> - yes

If I run:
=============================================
Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Forms![FrmGrund1]!Form.[FrmDiagram].Requery
End If
End Sub
=============================================
..I'll get "Can't find field 'Form'" error 2465

Kent J.




Jeanette Cunningham skrev:
Hi Kent,
is the form with the diagram on a tab control?
Tab controls have an event called the Change event.
Assume you have a tab control called tabOrders with 2 pages
Assume that frmDiagram is on the 2nd page of tabOrders.
Assume that FrmDiagram is the name of the subform control and that
FrmDiagram is the name of the form inside the subform control.
Note: the name of the subform control is not always the same as the name
of the form inside the subform control.
To refer to a control on a subform you need to use syntax like this:
Forms![MainFormName]!Form.[NameOfControlOnSubformInsideSubformControl]

You would use code something like this:

Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Forms![FrmGrund1]!form.[FrmDiagram].Requery
End If
End Sub

If the tab control is on the 1st page, tabOrders has a value of 0.
If the tab control in on the 2nd page, tabOrders has a value of 1.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Kent J said:
Hi all,

I have diagram on a subform and I want the diagram to be updated when I
click on the Tab. Something like:
========================================
Private Sub Diagram_1_Click()
Forms![FrmGrund1]![FrmDiagram].Requery
End Sub
========================================

What have I missed?

Kent J.
 
K

Kent J

OK!
I've tried what you suggested:

Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Me.[FrmDiagram].Form.Requery
End If
End Sub

But nothing happens


Kent J.






Jeanette Cunningham skrev:
My mistake

Forms![FrmGrund1]!Form.[FrmDiagram].Requery
this should be

Forms![FrmGrund1]![FrmDiagram].Form.Requery

The .Form needs to be after the name of the subform control, not before it.

The other point relates to forms and tab controls.
When a tab control is on the main form, you don't need to use the construct
Forms![FrmGrund1]

Instead use Me

So the code becomes
Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Me.[FrmDiagram].Form.Requery
End If
End Sub

Make sure you use the correct value of the tab control.
If on the 1st page the tab control has a value of 0
If on the 2nd page, the tab control has a value of 1 and so on


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Kent J said:
Hi,
Thanks for your reply!
<<..is the form with the diagram on a tab control?>>
Yes, it is.

<<tab control called tabOrders>> - yes
<<FrmDiagram is the name of the subform control>> - yes
<<FrmDiagram is the name of the form inside the subform control>> - yes

If I run:
=============================================
Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Forms![FrmGrund1]!Form.[FrmDiagram].Requery
End If
End Sub
=============================================
..I'll get "Can't find field 'Form'" error 2465

Kent J.

Jeanette Cunningham skrev:
Hi Kent,
is the form with the diagram on a tab control?
Tab controls have an event called the Change event.
Assume you have a tab control called tabOrders with 2 pages
Assume that frmDiagram is on the 2nd page of tabOrders.
Assume that FrmDiagram is the name of the subform control and that
FrmDiagram is the name of the form inside the subform control.
Note: the name of the subform control is not always the same as the name
of the form inside the subform control.
To refer to a control on a subform you need to use syntax like this:
Forms![MainFormName]!Form.[NameOfControlOnSubformInsideSubformControl]

You would use code something like this:

Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Forms![FrmGrund1]!form.[FrmDiagram].Requery
End If
End Sub

If the tab control is on the 1st page, tabOrders has a value of 0.
If the tab control in on the 2nd page, tabOrders has a value of 1.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Hi all,

I have diagram on a subform and I want the diagram to be updated when I
click on the Tab. Something like:
========================================
Private Sub Diagram_1_Click()
Forms![FrmGrund1]![FrmDiagram].Requery
End Sub
========================================

What have I missed?

Kent J.
 
J

Jeanette Cunningham

We could be having a problem with the names of your forms and controls.
Could you post the names of your
--main form
--tab control, the page position of the diagram on the tab control
--subform that the diagram form is on


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia



Kent J said:
OK!
I've tried what you suggested:

Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Me.[FrmDiagram].Form.Requery
End If
End Sub

But nothing happens


Kent J.






Jeanette Cunningham skrev:
My mistake

Forms![FrmGrund1]!Form.[FrmDiagram].Requery
this should be

Forms![FrmGrund1]![FrmDiagram].Form.Requery

The .Form needs to be after the name of the subform control, not before
it.

The other point relates to forms and tab controls.
When a tab control is on the main form, you don't need to use the
construct Forms![FrmGrund1]

Instead use Me

So the code becomes
Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Me.[FrmDiagram].Form.Requery
End If
End Sub

Make sure you use the correct value of the tab control.
If on the 1st page the tab control has a value of 0
If on the 2nd page, the tab control has a value of 1 and so on


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Kent J said:
Hi,
Thanks for your reply!
<<..is the form with the diagram on a tab control?>>
Yes, it is.

<<tab control called tabOrders>> - yes
<<FrmDiagram is the name of the subform control>> - yes
<<FrmDiagram is the name of the form inside the subform control>> - yes

If I run:
=============================================
Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Forms![FrmGrund1]!Form.[FrmDiagram].Requery
End If
End Sub
=============================================
..I'll get "Can't find field 'Form'" error 2465

Kent J.

Jeanette Cunningham skrev:
Hi Kent,
is the form with the diagram on a tab control?
Tab controls have an event called the Change event.
Assume you have a tab control called tabOrders with 2 pages
Assume that frmDiagram is on the 2nd page of tabOrders.
Assume that FrmDiagram is the name of the subform control and that
FrmDiagram is the name of the form inside the subform control.
Note: the name of the subform control is not always the same as the
name of the form inside the subform control.
To refer to a control on a subform you need to use syntax like this:
Forms![MainFormName]!Form.[NameOfControlOnSubformInsideSubformControl]

You would use code something like this:

Private Sub tabOrders_Change
If Me.tabOrders = 1 then
Forms![FrmGrund1]!form.[FrmDiagram].Requery
End If
End Sub

If the tab control is on the 1st page, tabOrders has a value of 0.
If the tab control in on the 2nd page, tabOrders has a value of 1.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Hi all,

I have diagram on a subform and I want the diagram to be updated when
I click on the Tab. Something like:
========================================
Private Sub Diagram_1_Click()
Forms![FrmGrund1]![FrmDiagram].Requery
End Sub
========================================

What have I missed?

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