×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

code for command button is a mystery

code for command button is a mystery

code for command button is a mystery

(OP)
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?

RE: code for command button is a mystery

When in doubt go to the Tape Backup and get the most recent copy you can and look at it carefully before making changes.

DougP, MCP
dposton@universal1.com

Ask me how Bar-codes can help you be more productive.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close