I have command buttons on a subform which progress through subsequent years of data on the subform -- i.e. the 1998-99 button shows data for 1998-99, the 1999-00 button shows data for 1999-00. At the suggestion of the person who created the buttons, I've tried adding a button for this year 2000-01 by copying the 99-00 button and changing one line of the code. The code for the 99-00 button is below:
Option Compare Database
Option Explicit
Private Sub cmdFind1998_99Data_Click()
On Error GoTo Err_cmdFind1998_99Data_Click
DoCmd.GoToRecord , , acGoTo, 1
Exit_cmdFind1998_99Data_Click:
Exit Sub
Err_cmdFind1998_99Data_Click:
MsgBox Err.Description
Resume Exit_cmdFind1998_99Data_Click
End Sub
Private Sub cmdFind1999_00Data_Click()
On Error GoTo Err_cmdFind1999_00Data_Click
DoCmd.GoToRecord , , acGoTo, 2
Exit_cmdFind1999_00Data_Click:
Exit Sub
Err_cmdFind1999_00Data_Click:
MsgBox Err.Description
Resume Exit_cmdFind1999_00Data_Click
End Sub
Private Sub Command181_Click()
End Sub
Private Sub Command182_Click()
End Sub
Private Sub Command183_Click()
End Sub
Private Sub cmdFind2000_01Data_Click()
End Sub
I tried changing this line
DoCmd.GoToRecord , , acGoTo, 2
to read
DoCmd.GoToRecord , , acGoTo, 3
I end up with both the copied button and the new button pointing to the new year's data instead of three buttons pointing to three different year's data -- what's going on?
[sig][/sig]
Option Compare Database
Option Explicit
Private Sub cmdFind1998_99Data_Click()
On Error GoTo Err_cmdFind1998_99Data_Click
DoCmd.GoToRecord , , acGoTo, 1
Exit_cmdFind1998_99Data_Click:
Exit Sub
Err_cmdFind1998_99Data_Click:
MsgBox Err.Description
Resume Exit_cmdFind1998_99Data_Click
End Sub
Private Sub cmdFind1999_00Data_Click()
On Error GoTo Err_cmdFind1999_00Data_Click
DoCmd.GoToRecord , , acGoTo, 2
Exit_cmdFind1999_00Data_Click:
Exit Sub
Err_cmdFind1999_00Data_Click:
MsgBox Err.Description
Resume Exit_cmdFind1999_00Data_Click
End Sub
Private Sub Command181_Click()
End Sub
Private Sub Command182_Click()
End Sub
Private Sub Command183_Click()
End Sub
Private Sub cmdFind2000_01Data_Click()
End Sub
I tried changing this line
DoCmd.GoToRecord , , acGoTo, 2
to read
DoCmd.GoToRecord , , acGoTo, 3
I end up with both the copied button and the new button pointing to the new year's data instead of three buttons pointing to three different year's data -- what's going on?
[sig][/sig]