data in subforms

boomerang boi

Registered User.
Local time
Today, 21:02
Joined
Apr 14, 2008
Messages
16
I have a form with tab control. It has 8 tabs and each page/tab of it consists of one subform only. Like:

tab1-subform1 = need to export data from NUMBER field.
tab2-subform2 - tab8-subform8 = need to get the data from the NUMBER field in subform1 and must be filtered the tab2 when the tab2 is being clicked.

The subform2 has NUMBER field also. How can I get a data from a field in tab1 and use it to filter when I click the another tab.
 
Simple Software Solutions

Use the controls ControlSource property to point to the relevant control found elsewhere on your form.
This will cause to to be dynamically updated when the user revised the source entry.

CodeMaster::cool:
 
I have 8 different tables for each subform. So as I see, it won't work right?
 
The subform2 has NUMBER field also. How can I get a data from a field in tab1 and use it to filter when I click the another tab.

If you just want it to filter based on the selected record in the first tab then I'd use the OnChange event of the Tab Control to grab the value selected in the first subform and filter the proceeding subforms.

Kinda like this repeated for each subform: (haven't tested)

Code:
Private Sub TabCtl0_[COLOR=red]Change[/COLOR]()
Dim frm As Form
Dim myValue As [COLOR=red]Long[/COLOR]
 
myValue = Me.[COLOR=red]S[/COLOR][COLOR=red]UBFORM1[/COLOR].Form.Controls("[COLOR=red]MY_KEY_FIELD[/COLOR]").Value
 
Set frm = Me.[COLOR=red]SUBFORM2[/COLOR].Form
 
frm.RecordSource = "SELECT * FROM [COLOR=red]MyTable[/COLOR] WHERE [COLOR=red]MY_KEY_FIELD[/COLOR] = " & myValue
 
Me.[COLOR=#ff0000]SUBFORM2[/COLOR].Requery
 
End Sub

It's a start for you at least. You could probably even use the filter property rather than the RecordSource property ... have a crack anyway!

Regards,
Pete
 

Users who are viewing this thread

Back
Top Bottom