Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to "know" Which options were selected in a form...

Status
Not open for further replies.

Mcr13

IS-IT--Management
Apr 23, 2001
4
US
I'm working on a " Document Center" form, where the users of my application can to create, edit or print diferent word documents, for example:

1. select an "action" (Create, Edit or Print) the document(s) - I have used an option group = OK.

2. Select What kind of document(s) (one or more): Cover letter, Table of contents, doc3, doc4, ..doc6.(diferent docs - I have used check boxes to select each doc type =OK).

3. A command button to start the code...and get the results!!

Here is the Problem: I have a command button to start the Action: How can I determine which document(s) were selected by the user and do the "action" for each one of the selected documents???

in other words: let's say that a user had selected:
1. Action: Create.
2. Docs Selected: Doc1, Doc2 and Doc6 (3 docs)
3. Click OK and then Create those three docs selected!!

I have VBA functions that performs each "action" but how can I control When call each function for each doc selected, if had beeen selected??
Any Ideas??
Thanks
 
You should be able to check the values of the controls (I'm assuming combo box for the action and list box for the documents). When the user clicks the command button, have it execute vba to check the controls & have this module call the appropriate functions based on what the user selected.

To check the list box - loop thru the values in the list box checking the selected property.

Ex:
For i = 0 To ctlname.Listcount - 1
If ctlname.Selected(i) Then
-- set some variables to indicate selection
-- and then after capturing all selections use these
-- variables to determine which of your functions to call
Next i

For the combo box - just check the value property of the combo box control

Using the values from the select list & the values from the combo box, you can use conditional logic to execute the appropriate functon.

There may be an easier way, but this will work.

Hope this helps...

JJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top