Updating Data on a tabbed form

S

SAC

I have a main form and a subform which is on a tab of a tabbed form.

The main form had a combo box to lookup a record in a table which the subfom
has the detail.

When I lookup using record using the combo box on the main form, I'd like
the subform to be refreshed with the record.

How can I do this?

Thanks
 
K

kingston via AccessMonster.com

Is the main form bound to a dataset and is the subform linked to the main
form via Child/Master fields? It doesn't sound like this is the case. If
the main form is just a dummy form with no fields to link to, you'll need to
attach a procedure to the combobox, probably via its AfterUpdate event.

One way to do this without using the built-in form/subform functionality is
to base the subform on a query. The query would be based on the value of the
combobox in the main form (e.g. the criteria would be something like [Forms]!
[MainFormName]![ComboBoxControlName]). Then, the combobox AfterUpdate
procedure would be: Me.SubFormName.Requery.
 
S

SAC

Thanks for your response.

The main form is bound to a dataset and the subform is linked to the main
form and I tried the after update event of the combo box to requery the
subform, but it doesn't update.

Any ideas? I tried refresh also.





kingston via AccessMonster.com said:
Is the main form bound to a dataset and is the subform linked to the main
form via Child/Master fields? It doesn't sound like this is the case. If
the main form is just a dummy form with no fields to link to, you'll need to
attach a procedure to the combobox, probably via its AfterUpdate event.

One way to do this without using the built-in form/subform functionality is
to base the subform on a query. The query would be based on the value of the
combobox in the main form (e.g. the criteria would be something like [Forms]!
[MainFormName]![ComboBoxControlName]). Then, the combobox AfterUpdate
procedure would be: Me.SubFormName.Requery.

I have a main form and a subform which is on a tab of a tabbed form.

The main form had a combo box to lookup a record in a table which the subfom
has the detail.

When I lookup using record using the combo box on the main form, I'd like
the subform to be refreshed with the record.

How can I do this?

Thanks
 
K

kingston via AccessMonster.com

If the subform properties Link Child/Master Fields are set properly, there
should be no need to explicitly requery the subform. Does the subform work
independently of the main form? IOW, open the subform by itself and check
that it works as expected. Then verify the link between the main form and
subform (should be linked via the combobox or an ID field that is driven by
the combobox). If the link is correct, try deleting the subform control,
saving the main form, and re-embedding the subform.
Thanks for your response.

The main form is bound to a dataset and the subform is linked to the main
form and I tried the after update event of the combo box to requery the
subform, but it doesn't update.

Any ideas? I tried refresh also.
Is the main form bound to a dataset and is the subform linked to the main
form via Child/Master fields? It doesn't sound like this is the case. If
[quoted text clipped - 18 lines]
 
S

SAC

OK, I've cheked the things you mentioned:

The subform does work correctly independently.
The link if verified - the subform is linked to the combobox on the main
form.
I deleted the subform and re-embedded it.

Still doesn't work.

I did place an on-click event on the tabbed form and when I click that
(after I update the combo box on the main form), the subform (which is on
the tabbed form) does update.

Anything else I could try.

Does it matter that it's on a tabbed form?

Thanks for your help.
kingston via AccessMonster.com said:
If the subform properties Link Child/Master Fields are set properly, there
should be no need to explicitly requery the subform. Does the subform
work
independently of the main form? IOW, open the subform by itself and check
that it works as expected. Then verify the link between the main form and
subform (should be linked via the combobox or an ID field that is driven
by
the combobox). If the link is correct, try deleting the subform control,
saving the main form, and re-embedding the subform.
Thanks for your response.

The main form is bound to a dataset and the subform is linked to the main
form and I tried the after update event of the combo box to requery the
subform, but it doesn't update.

Any ideas? I tried refresh also.
Is the main form bound to a dataset and is the subform linked to the
main
form via Child/Master fields? It doesn't sound like this is the case.
If
[quoted text clipped - 18 lines]
 
K

kingston via AccessMonster.com

Please post the code you have for the tabbed form's OnClick event. What do
you mean by the tabbed form? Maybe I don't understand your set-up. I think
you have FormA with a tab control and in that tab control there is FormB. Is
that correct?
OK, I've cheked the things you mentioned:

The subform does work correctly independently.
The link if verified - the subform is linked to the combobox on the main
form.
I deleted the subform and re-embedded it.

Still doesn't work.

I did place an on-click event on the tabbed form and when I click that
(after I update the combo box on the main form), the subform (which is on
the tabbed form) does update.

Anything else I could try.

Does it matter that it's on a tabbed form?

Thanks for your help.
If the subform properties Link Child/Master Fields are set properly, there
should be no need to explicitly requery the subform. Does the subform
[quoted text clipped - 21 lines]
 
S

SAC

I put an on-entry event on the sub form to requery it and that seems to
work. I rather it work the other way...
 
S

SAC

Yes, that's correct.

Here's the code:

Private Sub TabCt10_Click
Me.Refresh
End Sub

I put this into the enter event for the form and it works also, but I'd
rather it change the record in the afterupdate event of the combo box on the
main form.

Thanks again.


Thanks for your help.
kingston via AccessMonster.com said:
Please post the code you have for the tabbed form's OnClick event. What do
you mean by the tabbed form? Maybe I don't understand your set-up. I think
you have FormA with a tab control and in that tab control there is FormB. Is
that correct?
OK, I've cheked the things you mentioned:

The subform does work correctly independently.
The link if verified - the subform is linked to the combobox on the main
form.
I deleted the subform and re-embedded it.

Still doesn't work.

I did place an on-click event on the tabbed form and when I click that
(after I update the combo box on the main form), the subform (which is on
the tabbed form) does update.

Anything else I could try.

Does it matter that it's on a tabbed form?

Thanks for your help.
If the subform properties Link Child/Master Fields are set properly, there
should be no need to explicitly requery the subform. Does the subform
[quoted text clipped - 21 lines]
 
K

kingston via AccessMonster.com

Try requerying (and refreshing) the tab control and not the subform in the
combobox's AfterUpdate event. I now we've tried variations of this before
but if refreshing the tab control does what you want, you should be able to
do it from the main control:

Me.TabCt10.Requery
Yes, that's correct.

Here's the code:

Private Sub TabCt10_Click
Me.Refresh
End Sub

I put this into the enter event for the form and it works also, but I'd
rather it change the record in the afterupdate event of the combo box on the
main form.

Thanks again.

Thanks for your help.
Please post the code you have for the tabbed form's OnClick event. What do
you mean by the tabbed form? Maybe I don't understand your set-up. I think
[quoted text clipped - 24 lines]
 
S

SAC

When I put that in it gives the error:

Method or data member not found.

kingston via AccessMonster.com said:
Try requerying (and refreshing) the tab control and not the subform in the
combobox's AfterUpdate event. I now we've tried variations of this before
but if refreshing the tab control does what you want, you should be able to
do it from the main control:

Me.TabCt10.Requery
Yes, that's correct.

Here's the code:

Private Sub TabCt10_Click
Me.Refresh
End Sub

I put this into the enter event for the form and it works also, but I'd
rather it change the record in the afterupdate event of the combo box on the
main form.

Thanks again.

Thanks for your help.
Please post the code you have for the tabbed form's OnClick event. What do
you mean by the tabbed form? Maybe I don't understand your set-up. I
think
[quoted text clipped - 24 lines]
 
K

kingston via AccessMonster.com

Is Me.TabCt10.Requery allowed? Let me see if I can get more insight into
your set-up. Correct me if I'm wrong.

You have a main form. It's datasource is a table (not a query). There is an
additional combobox in the form header (verify). When you make a selection,
the main form moves to the record corresponding to the combobox selection.
Within the main form is a tab control.

In one of the tabs of the tab control, there is a subform. The subform's
datasource is a related table (not a query). The subform is linked to the
main form via a field(s) of the main form's recordsource (not the combobox).

Do you have any code or macros attached to the main form, tab control, or
subform that you think might be pertinent? Put a debug stop in your code to
watch it work. There might be a timing issue here. Do this with the
original AfterUpdate event: Me.SubFormName.Requery

When I put that in it gives the error:

Method or data member not found.
Try requerying (and refreshing) the tab control and not the subform in the
combobox's AfterUpdate event. I now we've tried variations of this before
[quoted text clipped - 23 lines]
 
S

SAC

Is Me.TabCt10.Requery allowed? NO

The datasource for the subform is a query. Is this the problem???

You have a main form. It's datasource is a table (not a query). There is
an
additional combobox in the form header (verify). When you make a
selection,
the main form moves to the record corresponding to the combobox selection.
Within the main form is a tab control. - YES

In one of the tabs of the tab control, there is a subform. The subform's
datasource is a related table (not a query). NO it is a query.

The subform is linked to the main form's recordsource field which is the
control source for the combo box.

Very simple code....nothing else happening.

Thanks.

I've about given up and can just use the on enter event of the subform.
Hate to have you spending so much of your time on this. It would be nice if
it worked the "right" way, but sometimes I wonder if it's worth the time....






When I put that in it gives the error:

Method or data member not found.
Try requerying (and refreshing) the tab control and not the subform in the
combobox's AfterUpdate event. I now we've tried variations of this
before
[quoted text clipped - 23 lines]
 
K

kingston via AccessMonster.com

I'm sorry I couldn't help you solve this. It should work with a simple Me.
Subform.Requery on the combobox's AfterUpdate event. Maybe you can post it
again and someone else will pick it up.
Is Me.TabCt10.Requery allowed? NO

The datasource for the subform is a query. Is this the problem???

You have a main form. It's datasource is a table (not a query). There is
an
additional combobox in the form header (verify). When you make a
selection,
the main form moves to the record corresponding to the combobox selection.
Within the main form is a tab control. - YES

In one of the tabs of the tab control, there is a subform. The subform's
datasource is a related table (not a query). NO it is a query.

The subform is linked to the main form's recordsource field which is the
control source for the combo box.

Very simple code....nothing else happening.

Thanks.

I've about given up and can just use the on enter event of the subform.
Hate to have you spending so much of your time on this. It would be nice if
it worked the "right" way, but sometimes I wonder if it's worth the time....
When I put that in it gives the error:
[quoted text clipped - 5 lines]

Thanks
 
S

SAC

No prob. I really appreciate your help.

Thanks alot.

kingston via AccessMonster.com said:
I'm sorry I couldn't help you solve this. It should work with a simple Me.
Subform.Requery on the combobox's AfterUpdate event. Maybe you can post it
again and someone else will pick it up.
Is Me.TabCt10.Requery allowed? NO

The datasource for the subform is a query. Is this the problem???

You have a main form. It's datasource is a table (not a query). There is
an
additional combobox in the form header (verify). When you make a
selection,
the main form moves to the record corresponding to the combobox selection.
Within the main form is a tab control. - YES

In one of the tabs of the tab control, there is a subform. The subform's
datasource is a related table (not a query). NO it is a query.

The subform is linked to the main form's recordsource field which is the
control source for the combo box.

Very simple code....nothing else happening.

Thanks.

I've about given up and can just use the on enter event of the subform.
Hate to have you spending so much of your time on this. It would be nice if
it worked the "right" way, but sometimes I wonder if it's worth the time....
When I put that in it gives the error:
[quoted text clipped - 5 lines]
 

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