Hi All
 
Access 2002/2007
WinXPPro
 
 
Here's an interesting one. I've got a leaping bookmark!
 
Outline
I'm syncing a mainForm with a subForm. Both forms are populated from the same table using:
 
RecordSource= "SELECT * FROM Addrs WHERE yardy-yar"
RecordSetType = Dynaset
 
mainForm is in single form view, subForm is in datasheet view. Navigation buttons on mainForm, none on subForm.
 
The forms are NOT linked because I want the datasheet to display all records. There are other subforms linked to mainform however.
 
Aim
When a user clicks on a record in the subForm I want the mainForm to scroll to the same record. When user moves mainForm using nav buttons I want the subForm to scroll to same record.
To do this, I do 'tests' in both forms' current events. These compare current record IDs and do a FindFirst as req'd.
 
Issue
The above sync works fine for a while, say 10 or 15 times... then it starts to go wobbly....e.g.
 
1. subForm/mainForm both at recordID 50.
2. User clicks on recordID 20 in the subForm
3. subForm current event fires, instructs 'sync' routine in mainForm to go to recordID 20
4. 'Sync' routine in mainForm tells mainForm bookmark to move to recordID 20 .....
At this point, despite the forms NOT being linked, the current event in the subForm fires again... Debug shows current event is no longer at recordID 20 or even recordID 50 but at the record prior to recordID 50???...
5. Focus gets passed back to the mainForm 'Sync' proc where it completes
6. Focus then returns to subForm current event (as one would expect but at the wrong record).
 
From this point onwards, I get an out-of-memory error from the 'sync' during the bookmark move.
 
Any ideas anyone?
 
Thanks
 
Code
 
Public Longs are declared in both Forms i.e. Rec_Id_To_Mve_To
 
MainForm Current Event -
	
	
	
		
 
SubForm Current Event
	
	
	
		
 
MainForm 'Sync' Proc
	
	
	
		
 
SubForm 'Sync' Proc
	
	
	
		
 
I found this similar problem http://www.ms-windows.info/Link/article-35116.aspx but sadly no resolution...
 Access 2002/2007
WinXPPro
Here's an interesting one. I've got a leaping bookmark!
Outline
I'm syncing a mainForm with a subForm. Both forms are populated from the same table using:
RecordSource= "SELECT * FROM Addrs WHERE yardy-yar"
RecordSetType = Dynaset
mainForm is in single form view, subForm is in datasheet view. Navigation buttons on mainForm, none on subForm.
The forms are NOT linked because I want the datasheet to display all records. There are other subforms linked to mainform however.
Aim
When a user clicks on a record in the subForm I want the mainForm to scroll to the same record. When user moves mainForm using nav buttons I want the subForm to scroll to same record.
To do this, I do 'tests' in both forms' current events. These compare current record IDs and do a FindFirst as req'd.
Issue
The above sync works fine for a while, say 10 or 15 times... then it starts to go wobbly....e.g.
1. subForm/mainForm both at recordID 50.
2. User clicks on recordID 20 in the subForm
3. subForm current event fires, instructs 'sync' routine in mainForm to go to recordID 20
4. 'Sync' routine in mainForm tells mainForm bookmark to move to recordID 20 .....
At this point, despite the forms NOT being linked, the current event in the subForm fires again... Debug shows current event is no longer at recordID 20 or even recordID 50 but at the record prior to recordID 50???...
5. Focus gets passed back to the mainForm 'Sync' proc where it completes
6. Focus then returns to subForm current event (as one would expect but at the wrong record).
From this point onwards, I get an out-of-memory error from the 'sync' during the bookmark move.
Any ideas anyone?
Thanks
Code
Public Longs are declared in both Forms i.e. Rec_Id_To_Mve_To
MainForm Current Event -
		Code:
	
	
	Public Sub Form_Current() 
     If Me.Form!Unique_No <>  Me.Addrs_Dtls_SubForm.Form!Unique_No Then
          Me.Addrs_Dtls_SubForm.Form.Rec_Id_To_Mve_To = Me!Unique_No
          Call Me.Addrs_Dtls_SubForm.Form.Sync_To_Main_Form
     End If
Exit SubSubForm Current Event
		Code:
	
	
	Private Sub Form_Current()
    If Me.Parent.Form!Unique_No <> Me.Form!Unique_No Then
        Me.Parent.Rec_Id_To_Mve_To = Me!Unique_No
        Call Me.Parent.Sync_To_Addrs_Dtls_SubForm
    End If
End SubMainForm 'Sync' Proc
		Code:
	
	
	Public Sub Sync_To_Addrs_Dtls_SubForm()
    Dim rst As DAO.Recordset
 
    Set rst = Me.Form.RecordsetClone
    rst.FindFirst "[Unique_No]=" & Rec_Id_To_Mve_To
    If rst.NoMatch Then
        'Stay where we are
    Else
        Me.Form.Bookmark = rst.Bookmark
    End If
    rst.Close
    Set rst = Nothing
End SubSubForm 'Sync' Proc
		Code:
	
	
	Public Sub Sync_To_Main_Form()
    Dim rst As DAO.Recordset
 
    Set rst = Me.Form.RecordsetClone
    rst.FindFirst "[Unique_No]=" & Rec_Id_To_Mve_To
    If rst.NoMatch Then
        'Stay where we are
    Else
        Me.Form.Bookmark = rst.Bookmark
    End If
    rst.Close
    Set rst = Nothing
End SubI found this similar problem http://www.ms-windows.info/Link/article-35116.aspx but sadly no resolution...
 
	 )
 ) 
 
		 
 
		