Combobox and tab control subform

sasolini

Registered User.
Local time
Today, 23:46
Joined
Dec 27, 2004
Messages
61
Hi

I create 2 forms that contain up to 2 subforms. I use combobox on each of those two form for selectin data, and thatway changin recordsets of sobforms. And all that works ok. Now I want to move both two form to a "master form". The idea is to have a combobox on a master form, and a tabcontrol. Than each of those two forms on seperate pages of tabcontrol. And whan i would select a data thrue combobox on my masterform the data on subforms in my tab control would change.

So basicly i need a code that will tell my combobox to chage data of my subforms in my tabcontrol.


Thx
 
A form is a form, if all controls are on this tab form then all you need is an event that triggers when the tab is selected that tells the control to get the value of the control on the other page.
 
no no u did not understad me...

I need a code that will select a recordset of my form that is located in my tab control page...

The problem is that i dont know the code of combobox...thats the code that i have:

Private Sub Combo22_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Producer Code] = '" & Me![Combo22] & "'"
Me.Bookmark = rs.Bookmark
End Sub

And this works if my combobox is located in the form that contain my subforms. But now i want to delete that combobox and make a new one on my masterform that contains tabcontrol and a form1 likted via subform/subreport. So when i move combobox from my form1 to my masterform the conde need to be change, but i dont know to what???

Hope i make my slef cleare now....

thx
 
If you set up the Parent/Child links correctly the Subforms will update when you Requery the main form.
To do this you need the same field on all forms.
e.g. RecordID

The code is just :
Code:
Private Sub Combo22_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Producer Code] = '" & Me![Combo22] & "'"
Me.Bookmark = rs.Bookmark

[b]Me.Requery[/b]

End Sub

Another point to note, I would avoid naming your fields with spaces in them, it a lot better practice to do this. It also avoids those pesky ['s in you code.

ProducerCode will do
 
Ian Mac said:
If you set up the Parent/Child links correctly the Subforms will update when you Requery the main form.

Somehow i get an error "Can't build a link between unbound forms" when i try to set parent/child links...


P.S.: I never use parent/child function before...

Thx
 
sasolini said:
Somehow i get an error "Can't build a link between unbound forms" when i try to set parent/child links...


P.S.: I never use parent/child function before...

Thx

Best thing is to delete then add the Subform again, should be ok after that.
 
thx for the help...but some how looks like you make a small mistake ;)

I did need to link thoste think together, first i need to set a recordsorce for my masterform, than i could link them together with no problem. But the code of my combobox need to stay unchanged! So Me.Requery must be deletet ;)

Ok thx anyway becouse u did help me alot...
 

Users who are viewing this thread

Back
Top Bottom