subforms on tab control

vickiwells

Registered User.
Local time
Today, 15:28
Joined
Jun 30, 2000
Messages
61
I have two subforms on separate pages of a tab control. They both contain information about the same records, there were just too many to put on one page. I'm linked OK to the main form, but what I need is for the two tabbed pages to show the same records. If I've had to scroll down the page on the first subform, I have to look for it again when I go to the next tab. Does that make sense? Can it be fixed?
 
Each time you page down, requery the page your not on. That will keep the tabded pages in sync, i.e. on the same record.
 
How do I requery the page?
 
It's just Me.NameOfSubform.Requery
you need to find a suitable event to put this code into, I usually go for the CHANGE event of the whole tab control object, then use Select...case to find out which page is current, then requery the subforms on that page, so that the page is always updated each time you visit it.

Here's a snippet of code from one of my databases:

Private Sub TabCtl27_Change()

Select Case (Me.TabCtl27.Value)
Case 0
'if the magazine titles page is current
Me.magazine_titles_subform.Requery
Case 1
'if the issues page is current
Me.Combo52.Requery
Me.magazines_subform.Requery
Case 2
'if the customers
Me.Customers_subform.Requery
Case 3
'if the customer allocations page is current
Me.Combo11.Requery
Me.Combo15.Requery
Me.Allocations_subform.Requery
Me.system_subform.Requery
End Select

End Sub

Hope this helps

Mike

[This message has been edited by Mike Gurman (edited 03-16-2001).]
 
My problem is very similar to Vickiwells. However there is a one to many relationship in within the form ie The "One" side forms the Main part of the form, while the "many" side forms the subforms portion. Because there was too much information to place on the screen, I split the "many" side in two and tabbed the subforms.

What I need is for the two tabbed pages to show the same record, without having to tab down separately on the two pages.

I've had a brain cramp trying to figure this out!
 
I wouldn't use 2 subforms to display the data (presuming the data is in one table). One form or subform, with the various fields put on different tabs, as appropriate.
 
My problem is very similar to Vickiwells. However there is a one to many relationship in within the form ie The "One" side forms the Main part of the form, while the "many" side forms the subforms portion. Because there was too much information to place on the screen, I split the "many" side in two and tabbed the subforms.

What I need is for the two tabbed pages to show the same record, without having to tab down separately on the two pages.

I've had a brain cramp trying to figure this out!


I believe you simply need to set the master/child fields. To do this, double click on the control that contains the subform, then in the properties page, at the very top you will see parent/child. Those are probably blank. Click on the elipses (...) and in the dialog that pops up, you should be able to just click okay. If the dialog is blank, then just fill in what ever field relates the main form with the subform (workorderID, customerID, employeeID, etc).

Hope that helps.
 
pbaldy,

I'm afraid I don't understand what you are saying:

>> with the various fields put on different tabs, as appropriate.

The tabs each require a subform, don't they?

This is how it is laid out:

Form (one)
|
|------------|
Tab1 Tab2
| |
Subform1 Subform2
(many) (many con'td)

Regards,
 
Last edited:
I would have a tab control on one subform, not two subforms on a tab. Speaker's point is a good one as well.
 

Users who are viewing this thread

Back
Top Bottom