Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

code for command button is a mystery

Status
Not open for further replies.

lshippee

Technical User
Jul 19, 2000
36
0
0
US
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]
 
When in doubt go to the Tape Backup and get the most recent copy you can and look at it carefully before making changes. [sig]<p>DougP, MCP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top