User selection of code

Peter Bellamy

Registered User.
Local time
Today, 09:06
Joined
Dec 3, 2005
Messages
295
I have a button on a form that runs some vba code.
The code run is dependant upon what the user wants to do:
Method 1
Method 2
Method 3
Abort
It is only valid to choose one method

At the moment I use sequential message boxes for each 'Method', enabling the user to do or not each step. What I would prefer is to give them all the choices and then they choose just one. (they could at the moment choose morethan one !!)
It seems message boxes can't do this, 4 choices with bespoke labeling of the buttons ??
Any suggestions?

Cheers

pnb
 
Howzit

You can use the Option Group Contol, which only allows the selection of one option at a time. From there , depending on which option the user selects you can activate the relevant code.

Use the wizard to set up the option group.
 
Howzit

As an example:

I have a option group called fraReports (5 option buttons).

I also have a command button that when clicked has the following

Code:
Select case me.fraReports
Case 1:
do something
Case 2:
do something else
case 3:
and for something entirely different
etc
end select
 
Another way to do it is to provide a dropdown box and a button - the event code of the button checks the value selected in the dropdown (in a Select Case as above) and runs the appropriate code.

This method might be more suitable if the list of options is likely to grow in the future, as it won't demand changes to the form layout.
 

Users who are viewing this thread

Back
Top Bottom