Pyro
Too busy to comment
- Local time
- Tomorrow, 09:59
- Joined
- Apr 2, 2009
- Messages
- 127
Hi,
I have two subforms (both showing data from the same table) synced together by having the PK of the second subform set to the primary key of the first. When i cycle through the records on the first subform, i am requerying the second so that it displays the same record. For that i am using this code:
However without the
When the parent form is opened, I get the error (2455) "You entered an expression that has an invalid reference to the property Form/Report."
With the error trap, everything works as it should on the form - the requery works correctly, and the forms are synced as i want them.
Is there a simpler way to do this? or is there a way to fix it so that without the error trap, the code works as it should?
Thanks.
I have two subforms (both showing data from the same table) synced together by having the PK of the second subform set to the primary key of the first. When i cycle through the records on the first subform, i am requerying the second so that it displays the same record. For that i am using this code:
Code:
[COLOR=black][FONT=Verdana]Private Sub Form_Current()[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]On Error GoTo Err_Form_Current[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]If Forms![frm_Contact_Register]![sfrm_Communication_D].SourceObject = "sfrm_Communication_D" Then[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] Forms![frm_Contact_Register]![sfrm_Communication_D].Form.Requery[/FONT][/COLOR]
[FONT=Verdana][COLOR=black]End If[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Exit_Form_Current:[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Exit Sub[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]Err_Form_Current:[/FONT][/COLOR]
[FONT=Verdana][COLOR=black] If Err <> 2455 Then[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] MsgBox Err.Description[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] Resume Exit_Form_Current[/COLOR][/FONT]
[FONT=Verdana][COLOR=black] End If[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]End Sub[/FONT][/COLOR]
However without the
Code:
If err <> 2455 then...
When the parent form is opened, I get the error (2455) "You entered an expression that has an invalid reference to the property Form/Report."
With the error trap, everything works as it should on the form - the requery works correctly, and the forms are synced as i want them.
Is there a simpler way to do this? or is there a way to fix it so that without the error trap, the code works as it should?
Thanks.