Solved

Command Button Help

Posted on 2000-04-23
1
126 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
1 Comment
 
LVL 5

Accepted Solution

by:
yronnen earned 100 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now