Hi gang,
Just spent most of today and all evening trying to get this to work and access keeps giving me a "Run Time error '2489' so before I tear all my hair out can any one suggest how to do what I need.
I am trying to write the code for Custom Navigation Buttons like - Next, Prev, First, New & so on.
I have a main form [frmMain] that is not bound to anything, it just acts as a holder for the sub-form and contains a couple of labels like the database name and so on.
On the main form is a sub-form [frmSub1] that is bound to the table that contains the actual data.
I want to have a set of buttons on the main unbound form that moves the records back or forth. To keep it simple, if we look at just the "next record" button.
I inserted a command button and on its "on click" property I have tried various code but none of it worked. I have searched all over the net but with no luck. I keep getting the same run-time error '2489' The Object '[Forms]![frmMain].[Form]![frmSub1]' isn't open? Below is a code sample so you know what I have tried to do so far.
Thank you in advance,
Kenny
------------------Code Begins-----------------------
Private Sub cmdGoToNext_Click()
DoCmd.GoToRecord acDataForm, "[Forms]![frmMain].[Form]![frmSub1]", acNext
End Sub
------------------Code Ends-------------------------
Just spent most of today and all evening trying to get this to work and access keeps giving me a "Run Time error '2489' so before I tear all my hair out can any one suggest how to do what I need.
I am trying to write the code for Custom Navigation Buttons like - Next, Prev, First, New & so on.
I have a main form [frmMain] that is not bound to anything, it just acts as a holder for the sub-form and contains a couple of labels like the database name and so on.
On the main form is a sub-form [frmSub1] that is bound to the table that contains the actual data.
I want to have a set of buttons on the main unbound form that moves the records back or forth. To keep it simple, if we look at just the "next record" button.
I inserted a command button and on its "on click" property I have tried various code but none of it worked. I have searched all over the net but with no luck. I keep getting the same run-time error '2489' The Object '[Forms]![frmMain].[Form]![frmSub1]' isn't open? Below is a code sample so you know what I have tried to do so far.
Thank you in advance,
Kenny
------------------Code Begins-----------------------
Private Sub cmdGoToNext_Click()
DoCmd.GoToRecord acDataForm, "[Forms]![frmMain].[Form]![frmSub1]", acNext
End Sub
------------------Code Ends-------------------------