Go to specific record in subform

Ashleyjp1985

Registered User.
Local time
Today, 22:28
Joined
Jul 6, 2011
Messages
22
Hi,

I have a main form and a nested subform. The main form is based on customer details and displays customer name and the customer primary key (custID). When this form is opened i pass two parameters to it, BPID and SIID.

A BP is a business picture and a SI is a sales interaction. These are in a one to many relationship.

The subform displays a sales interactions (si) of a business picture (bP).

The subform is set up with master child links of custid;bpid. This restricts the subform to only showing records for the a specific customer and specific BP (the user can cycle through all the linked SI's using the record selectors.

When the main form is opened I want the subform to display the sales interaction the user has selected when opening the main form based on the passed SIID but cannot get this to work. At the moment the subform just displays the first record. I have tried numerous methods but am very stuck. Any help?
 
I have tried adding the siid to the master/child link which does work in that it opens at the specific record but it then doesn't allow the user to cycle though the related records.
 
I thought i had it working!

I added the below code to the on load event of the parent form and when i first run it it worked! the nested sub from displayed the correct record and did so for the next few that i tried. There were 10 related records in this example and after number 4 it stopped working. When the form opened the subform very briefly went to the correct record then jumped to add a new record. Any help????

Dim rs As Object
Dim lngBookmark As Long

lngBookmark = Me.SIID

Set rs = Me.SubformPopformQCustomerSI.Form.RecordsetClone
rs.FindFirst "SIID = " & lngBookmark

Me.SubformPopformQCustomerSI.Form.Bookmark = rs.Bookmark

Set rs = Nothing
 

Users who are viewing this thread

Back
Top Bottom