synchronise two subforms

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

Guest

Hi
I have two subforms on my form which are using same reference to the main
form.
The main form consists main record number (Purchase order number)
subform is a materials list for that purchase order.
second subform is in fact query which summarises how many of these materials
were delivered (basing on other form/table). So as result I'm getting a list
showing how many materials from PO were delivered. Now, I want to synchronise
these two subforms, so when I'm scrolling one, the other one follows. I found
one post in which there was a code for current event in both subforms:

Private Sub Form_Current()

Dim rs As Recordset

If (Not IsNull(Me![ID])) And _
(Not IsNull(Parent.OtherSubFormControl.Form![ID])) And _
(Me![ID] <> Parent.OtherSubFormControl.Form![ID]) Then
Set rs = Parent.OtherSubFormControl.Form.RecordsetClone
rs.FindFirst "ID = " & Me![ID]
If Not rs.NoMatch Then
Parent.OtherSubFormControl.Form.Bookmark = rs.Bookmark
End If
End If

End Sub

Now, maybe it's correct, but could anyone explain what [ID] is.
Is it a lookup ID to the main form? If yes, my subform doesn't contain it.
I've made both subforms using wizard and they contain only data I've picked
for display on main form.
PLease help.
 
Hi

Me.[ID] or Me![ID] refers to the field called ID. In your case you would
use
Me.[Purchase order number field name]

Hope this helps
 
Correct me if I'm wrong: ID is a number in main form? Or subform? If subform,
shall I create a relationship between both subforms keys? (I have only
relationship to main table)

Thanks

Wayne-I-M said:
Hi

Me.[ID] or Me![ID] refers to the field called ID. In your case you would
use
Me.[Purchase order number field name]

Hope this helps

--
Wayne
Manchester, England.



realspido said:
Hi
I have two subforms on my form which are using same reference to the main
form.
The main form consists main record number (Purchase order number)
subform is a materials list for that purchase order.
second subform is in fact query which summarises how many of these materials
were delivered (basing on other form/table). So as result I'm getting a list
showing how many materials from PO were delivered. Now, I want to synchronise
these two subforms, so when I'm scrolling one, the other one follows. I found
one post in which there was a code for current event in both subforms:

Private Sub Form_Current()

Dim rs As Recordset

If (Not IsNull(Me![ID])) And _
(Not IsNull(Parent.OtherSubFormControl.Form![ID])) And _
(Me![ID] <> Parent.OtherSubFormControl.Form![ID]) Then
Set rs = Parent.OtherSubFormControl.Form.RecordsetClone
rs.FindFirst "ID = " & Me![ID]
If Not rs.NoMatch Then
Parent.OtherSubFormControl.Form.Bookmark = rs.Bookmark
End If
End If

End Sub

Now, maybe it's correct, but could anyone explain what [ID] is.
Is it a lookup ID to the main form? If yes, my subform doesn't contain it.
I've made both subforms using wizard and they contain only data I've picked
for display on main form.
PLease help.
 
Back
Top