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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 subforms and filtering data

Status
Not open for further replies.

abenitez77

IS-IT--Management
Oct 18, 2007
147
US
I have a form with 2 subforms.When i move from record to record on subform1, I want subform 2 to filter on the key.I currently have code running on the "On Current" that creates a table for subform2, but it does not filter the results by the current record we are on in subform1.
How can i do this?
 
How are ya abenitez77 . . .
abenitez77 said:
[blue]I currently have code running on the "On Current" that creates a table for subform2, ...[/blue]
Why are you creating a table? ... unless your [blue]not familiar with filtering[/blue] this shouldn't be necessary.

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
The way I do this is
1) put a hidden text box on the main form. Call it txtbxLink
2) on subform1 on current event put
me.parent.txtbxLink = me.YourPrimaryKeyNameHere
3) in the link master / child field properties of subform control 2 put
link Master Fields: [txtBxLink]
link child fields: yourForeingnKeyNameHere

When you select a record in sub1 it will show the corresponding in sub 2
 
I am using unbound forms. I did what you said and I can see the value in the textbox i put in the main form. I put that textbox name in the link master fields of the 2nd subform and I put the foreignkeyname in the link child fields (=[frm_EmailAttachments subform].[Form]![EmailGuid]). It did not work. when i remove this...i do see the records in the 2nd subform. but when I added this, it was blank and links were not working.
 
abenitez77 said:
[blue]I am using unbound forms.[/blue]
You can't synchronize [blue]unbound forms[/blue] with [blue]Master/Child Link[/blue] properties. Besides that ... how are you moving from record to record on subform1 if its unbound?

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
I put that textbox name in the link master fields of the 2nd subform and I put the foreignkeyname in the link child fields (=[frm_EmailAttachments subform].[Form]![EmailGuid])
I am assuming the subforms are bound and the main form is unbound. If not I am also lost.

However lets assume the subforms are bound, you would simply refer to the fk as [emailGuid]. I did not try it, but am skeptical of using a full identifier as you have it. I doubt that would work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top