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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Choosing more than 1 option in a Option group

Status
Not open for further replies.

mpsDA

IS-IT--Management
Jul 27, 2005
43
GB
How do you go about selecting more than 1 option in a Option Group and places the result of selected items into the correct Field.
 


Hi,

Options in an Option Group are, by definition, mutually exclusive.

You might want to use Check Boxes instead.

Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
As far as I recall, option groups are used to select one option from a group. Where multiple choices are permitted, option buttons are more useful.
 
How do you go about setting up these options buttons so the value is placed into the correct field?
 
How do you expect a single field will hold more than 1 option ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ok so if a databse was allowing you to select more than one option, were will the data be stored. There must be away round this does anyone have any ideas?
 
I think it really depends on what the options are and what you intend to do with them. In one case, a separate table may be appropriate, in another case two or more fields might be best.
 
It sounds like you have several options, and the user might want one, two, three, or even all of the options to be used during the requested procedure.

In order to allow more than one option to be selected within an OptionBox, place the options first, then place the OptionBox around them. You will then need to name each individual option button a meaningful name.

As you run the procedure that can use these multiple options, refer to each individual name of these options within your code. If you must have one field somewhere that holds all the selected options, I would place my assigned value for each optioin into this common field, with each individual option value separated by commas.

For additional approaches, please refine your request and post again.

By the way, I use this technique often.
Hope this helps.
 
VicRauch
Ok Finally who knows what they talking about..
Yes your right It is how you have stated.
So you Place the options i.e. using the Option Button placing as many options I like as in my case I have Only 4. Once I have Placed my options..
DO I place the Option Group Around these?

As for the Code can you give me an example please of the code.
Thanks
 
How are ya mpsDA . . .
Remou said:
[blue]I think it really depends on what the options are and what you intend to do with them.[/blue]
Without an answer to this what to tell you for full resolution of this problem is a guess at best! . . .

[blue] . . . and your answer is?[/blue]

Calvin.gif
See Ya! . . . . . .
 
Ok Finally who knows what they talking about..

NO!

Finally, someone who figured out what YOU THINK YOU were talking about!

Please be clear, concise and complete.

Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
OptionBoxSamles.gif

Using this image from my form, then look at the following code that is called the "Process" button from this form. The Yellow background fields at the top are all Visible=False fields within the form header. Their field names are in the labels to each field's left.
The other fields (gray background) are named "chk" & the field description. I really think it will be easy to follow. The combo boxes are started with "cbo" in their field names.

The code explained:
The first four lines allow me to "select" or "unselect" each of the four options of which component of the report the user wants included.

The code just under the "With Me" line:
These first 3 lines are checking against the "Report(s) to Preocess" from the sample form. The next line is if the "Core Business: Marketing Source" check box is selected. And if it is, I build the appropriate Pie Chart, based on which options were selected on the Component portion of the form.

Hope this helps.
Vic

Code:
 If chkFranchise Then Me!DetailLevel1 = "1" _
       Else Me!DetailLevel1 = "9"
  If chkRegion Then Me!DetailLevel2 = "2" _
       Else Me!DetailLevel2 = "9"
  If chkRevenue Then Me!DetailLevel3 = "3" _
       Else Me!DetailLevel3 = "9"
  If chkAggregate Then Me!DetailLevel4 = "4" _
       Else Me!DetailLevel4 = "9"
  Me!SelectFranchiseNumber = Me!cboFranchise
  Me!SelectRegion = Me!cboRegion
  Me!SelectRevenue = Me!cboRevenue
  
'This routine will analyze the New Marketing and 
'  Sales Reports form, then run which ever reports
'  are requested.

With Me
  If !chkPercentOfSales Then PercentOfSalesChartBuild
  If !chkCostPerLeadEtc Then CostPerLeadEtcChartBuild
  If !chkROI Then ReturnOnInvestmentChartBuild
  
  If !chkCoreBusiness Then
    If !chkFranchise Then _
          MarketingMixFranchisePieChartBuild
    If !chkRegion Then _
          MarketingMixRegionPieChartBuild
    If !chkRevenue Then _
          MarketingMixRevenuePieChartBuild
    If !chkAggregate Then _ 
          MarketingMixAggregatePieChartBuild
  End If
End With
 
VIC
Just a few questions

What is With ME!

What part of the database is ME! (Do I need this part?)

The Default Leveles 1 - 4 is that the fields holding the data when selected?
 
Me is your form or object that is on focus. you do need the me! and the fields holding the data are

Me!SelectFranchiseNumber = Me!cboFranchise
Me!SelectRegion = Me!cboRegion
Me!SelectRevenue = Me!cboRevenue

The detaillevel just check which checkboxes are selected.

9 being not selected.

you could also do it with a select case.

Please correct me VIC if im wrong, just trying to help
 

[blue]You asked:
What is "With ME" What part of the database is ME! (Do I need this part?)[/blue]
"Me" is used within the VBA code of a form or report to refer to THE form or report. "Me" can not refer to any other form or report, just the one the code is attached to. If a form is named "frmEmployee" you could refer to the form by "Forms!frmEmployee" but Microsoft has given us a short way to refer to the form the code is associated with, "Me".

[blue]And you asked:
The Default Leveles 1 - 4 is that the fields holding the data when selected?[/blue]
I assume you mean DetailLevels1-4. Within my data, I have Franchise data coded as a "1", Region data coded as a "2", RevenueLevel coded as a "3", and Aggregate data coded as a "4". When the user does not want to see RevenueLevel data, then I place a "9" into the selection criteria my query will use later, as there is no data in the table coded a "9". Therefore, no records will be selected.
I need to explain here, my data is NOT normal data. But what I have done is summarized the "real" data into a format that allows me to easily create Excel spreadsheets and Excel charts. This is not a system I would suggest to anyone to emmulate, unless their specific situation called for this type of reporting.

Vic

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top