[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Command Button Help

Posted on 2000-04-23
1
Medium Priority
?
134 Views
Last Modified: 2010-05-02
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
Comment
Question by:Firestorm042300
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
yronnen earned 300 total points
ID: 2741485
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question