selecting same record in 2nd subform

robsworld78

Registered User.
Local time
Today, 01:28
Joined
May 31, 2011
Messages
99
Hi, I have a form with 3 subforms on it, One subform is for orders, the other 2 subforms show order details. The 2 bottom subforms need to always be on the same record at the same time.

If someone selects a record in the outlined subform that record also gets selected in the subform beside it.

I attached a pic of the form and you will see how each subform has a different record selected. When I click a record in the outlined subform I want the other to follow. I added some notes on the pic.
 

Attachments

If you wish to keep all records showing then you need to move the current record to match the current record in the first form. As I said in the other thread you can use FindRecord.

Another common alternative is to use FindFirst on a clone of the form's recordset and set the bookmark property of the form to the bookmark of the clone.
 
I'm trying the following but it says there's an invalid method in an expression.

Private Sub Form_Current()
Dim id_d1 As Long
id_d1 = Me.InventoryID

Forms!NightCount.NightCountInventorySubform.Form.SetFocus
DoCmd.FindRecord id_d1
End Sub
 
Another common alternative is to use FindFirst on a clone of the form's recordset and set the bookmark property of the form to the bookmark of the clone.

I've been reading about the following properties

Form.RecordsetClone Property

Form.Bookmark Property
Recordset.Bookmark Property

But its all very confusing, which one do I use and where?
 
If I use the following code on the outlined subform I can't select a record in the outlined subform unless that record is selected in the first subform.

But when I select a record in the first subfrom the outlined subform doesn't follow automatically. Once I click on that record in the outlined subform its locked there until I move the other record on the other subform.

Private Sub Form_Current()
With Me.Recordset
.FindFirst "InventoryID = " & Forms!NightCount!NightCountInventorySubform.Form.InventoryID
If .NoMatch Then
MsgBox "Record ID " & Forms!NightCount!NightCountInventorySubform.Form.InventoryID & " not found!"
End If
End With
End Sub

How far away am I?
 
Holy cow, I actually got it working. :) :)

Here's what did it.

Private Sub Form_Current()
With Forms!NightCount!NightCountInventorySubform.Form.Recordset
.FindFirst "InventoryID = " & Forms!NightCount!NightCountEnterReturnsSubform.Form.InventoryID
If .NoMatch Then
MsgBox "Record ID " & Forms!NightCount!NightCountEnterReturnsSubform.Form.InventoryID & " not found!"
End If
End With
End Sub

Thanks so much for your help!!
 

Users who are viewing this thread

Back
Top Bottom