Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SubForms in Tabs doesn't retreive Data

Status
Not open for further replies.

cparralesl

Programmer
Jan 27, 2002
118
NI
Ui guys,

I have had hard tme with a subform placed in a tab. I've spend two day woith no luck. Here is the issue:

The main form doesn't have a recordSource. There is a tab control and in each page i have a ListBox on wich I load records using code. I also created a sub form that I want to tie to the ListBox, the final behavior I want toahve is: For each item selected in the listbox, the sub form change the set of records according to the item selected in the Listbox.

Ex: The use selects a Prodcut Category in the listbox, the subform shows all the products that belongs to that category. I've place the same controls in differents pages of the tab. Of course, the data for each tab are all different, the Product/Category its an example.

The problem is with LinkMasterFields and the LinkChildFields . I'm setting this properties with code, but i can not make it work.

The value for the LinkMasterFields I save it in a Label.

Here is my code:
Code:
Me.[SFGinteresxCiudad].LinkMasterFields = Me.lblBarComValue.Caption
Me.[SFGinteresxCiudad].LinkChildFields = Me.[SFGinteresxCiudad].Form.ID_DEPARTAMENTO

The above is not workinh.

I Also have read all the posts about LinkMasterFields and LinkChildfields, but does not works.

Huys, I really appreciate the help you can give me about it.

Regards,



So, the code I use

Cesar Humberto Parrales
Application Support
 
When you state "For each item selected in the listbox" does this mean the list boxes are multi-select? If so, you will not be able to use Link Master/Child properties. It just doesn't work with multiple values.

A listbox does not have a "Caption" property. It does have a "Value" property which is its default property. The link Child would need to be the name of a field in the subform's record source. Are you changing the fields used to link?

Do the list boxes contain field names or field values?

Duane
Hook'D on Access
MS Access MVP
 
The listbox is not multi-select. The value select for the item in the listbox, is passed to label control. From there the subform takes the LinkMasterFields. I do not know how to tell the sub form that the LinkChildFields is the ID_DEPARTAMENTO field which is in the subform. As you can see in the LinkChildFields i'm trying to do that. but it doesno work

I really appreciate you help

regards,

Cesar Humberto Parrales
Application Support
 
Why not set these properties of the subform control
link master: ListboxNameHere
link child: ID_DEPARTAMENTO

I'm not sure why you would need code to do this.

Duane
Hook'D on Access
MS Access MVP
 
Hello guys,

I solve the problem. I use the name of the field of the subform instead of the name of the control.

I didn't know that, but certainly I spent three day to find out.

:(

But also appreciate your help about it.

I just wanted to manipulate the subform using a Main form without a table asociated to it. I use a Listbox take it from there the subform shows the set of records depending on the item selected in the listbox.

I make it and again thanks a lot. It just give me a clue.
:)

Regards,

Cesar Humberto Parrales
Application Support
 
I just wanted to manipulate the subform using a Main form without a table asociated to it.
What duane suggested does exactly that without any code and can be done in seconds.

I routinely have an unbound main form with a bound subform. On the main form I have a combo box. I link the subform control to the combobox as Duane shows. Change the value in the combobox and the subform filters.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top