• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 136
  • Last Modified:

Command Button Help

Ok, i'll try to explain what I'm trying to do: I have a visual basic questionaire set up with 4 command buttons.  What I need to do is when the user clicks on one of the buttons the program records the number button that was clicked in another database (eg. Access) and then goes to the next page of the questionaire.   Can anyone help??
0
Firestorm042300
Asked:
Firestorm042300
1 Solution
 
yronnenCommented:
Create an array of command buttons (place a command button on the form, mark it with the mouse and choose copy->paste. When VB asks if you want an array say yes, and then choose paste 2 more times).

When you have an array of buttons, they all share the same event code, and the only way that you can know which button was clicked is by using the index propety.

The click event of the buttons can look like that:
Private Sub Command1_Click(Index As Integer)
    SaveValue Index
End Sub

Where SaveValue is the function where you do what you have to do with your app and the index is the number of your button.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now