synchronise two subforms

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.
 
G

Guest

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
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Synchronize subform scrolling 4
SubForms 4
Link Two Subforms on a Main Form 1
If field =15 save in two tables 2
Sync two subforms 1
Command buttons, subforms and data entry 2
Subforms 10
Forms And Subforms 3

Top