Linking two subforms?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two subforms in a tab index on the same form and would like to link
them together. When I go to create a subform it only allows me to link it
with the main form. How would I go around this and make it work?

Thanks!
 
If you have a common key field you can mirror them by using the recordset
clone method,
Could look like something like this: you can put this for example in the "on
current event" of both subforms, one in one direction, in the other one in
the other direction
'goto right client in general tab
Forms!frmClients!frmClientList1.Form.RecordsetClone.FindFirst
"[client_id]=" & Forms!frmClients.frmClientsList2.Form.CLIENT_ID
If
Forms!frmClients!frmClientList1.Form.RecordsetClone.NoMatch Then
MsgBox "client not found"
Else
Forms!fForms!frmClients!frmClientList1.Form.Bookmark
= Forms!Forms!frmClients!frmClientList1.Form.RecordsetClone.Bookmark
End If
Hope this make sense to you

Philip
 
They are linked by a common field in a one to one relation but they are not
the keys of the table.

This is how it is set up
I have a main form that is for the invoice
then I have a tab subform control
On the first tab is the inventory which corresponds to the invoice.
On the second tab....... This is where I want to place the vendor info.
The vendor table is related to the inventory table by a serial # field and
is a one to one relation.

I am not quite sure I understand your code???

phleduc said:
If you have a common key field you can mirror them by using the recordset
clone method,
Could look like something like this: you can put this for example in the "on
current event" of both subforms, one in one direction, in the other one in
the other direction
'goto right client in general tab
Forms!frmClients!frmClientList1.Form.RecordsetClone.FindFirst
"[client_id]=" & Forms!frmClients.frmClientsList2.Form.CLIENT_ID
If
Forms!frmClients!frmClientList1.Form.RecordsetClone.NoMatch Then
MsgBox "client not found"
Else
Forms!fForms!frmClients!frmClientList1.Form.Bookmark
= Forms!Forms!frmClients!frmClientList1.Form.RecordsetClone.Bookmark
End If
Hope this make sense to you

Philip


GregB said:
I have two subforms in a tab index on the same form and would like to link
them together. When I go to create a subform it only allows me to link it
with the main form. How would I go around this and make it work?

Thanks!
 
Back
Top