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 (data sheet view)-same record source-linked by same id ?

Status
Not open for further replies.

pinstripe

Programmer
Dec 27, 2004
52
Hi all,

i am fighting with this rooky problem for some time now.

I have a form, and on this form 2 subforms.
In first subform i show sums (calculated on fly - datasheet mode), second subform is in "tab control box (form view)" to view details for selected record.
Yes, when in first subform a record is selected, the details for this record should be seen in subform 2!
Also, should "link child and master fields" be the same?

Unfortunately, i am just not able to figure it out alone.
Please, help.

Best,
Stan
 
Not quite sure what you are saying. Link Child fields and Master fields need not be the same, but often are; a typical example would be Order and OrderDetail, which would have an OrderID in common. The subform wizard is often quite helpful. [ponder]
 
Hi Remou,
thx for quick response!
You are right, i wasn't clear before.

In first subform i am puling data from same table (record source) as in subform 2.
Both subforms are linked(child and master field) by (autonuber) field "IdPrevoza"
The difference is just - in first subform i am showing some felds(datasheet view)and when clicked (on current)on the row, in subform two the details would be populated (the fields i haven't show in first subform)

Hopefully i was more clear now. If any other question is to be asked ... please!!
 
Sorry for being so slow, but do you mean something like the Customer Orders form in the NorthWind.mdb sample?
In that example, the link on subform 2 are:
Link Child Fields: OrderID
Link Master Fields: [Customer Orders Subform1].Form![OrderID]
 
How are ya pinstripe . . .

Have a look here faq702-5860

Calvin.gif
See Ya! . . . . . .
 
Remou,
i have been checking out several examples befor i made this post, and even NorthWind.mdb.
And you are right, it should look like Customer Orders form, but with this difference that in second subform i don't wanna show first subform's children but same record as in first one just with other fields (!!in form view mode!!) my doesn't work!
If i could put second subform on the first subform it would work prfectly,but beacuse they have different view modes this problem persist.

I am working now so i will try FAQ702-5860 later today, but if you might have another idea....
Thank both of you !
 
You may try something like this in the Current event procedure of subform1:
With Forms![name of main form]![name of subform2 control].Form
.Filter = "[name of primary key field]=" & Me![name of primary key control]
.FilterOn = True
End With

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
TheAceMan1 thank you for this FAQ
It is working fine!

Best to both of you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top