select case from combobox and option group

I have an series of actions that need to be executed from differnt types of 
controls on 2 different forms
one control is an option group, the second is a combobox (limit to list = 
yes)

the commands had already been moved to a sub, SetPresetOptions(frm as 
Access.form) <call SetPresetOptions(me) > , which is located in the same 
module as the option group (and can be moved to a differnet module if 
needed)

the code reads something like this:
    Select Case optSetPresetOptions
    case = 1
        do something
    case = 2
        dosomething else
    case = ....

How would I adjust the select code to also work with the combobox

many thanks in advance,
Mark 


0
Mark
2/1/2010 3:57:41 PM
access.formscoding 7493 articles. 0 followers. Follow

6 Replies
1219 Views

Similar Articles

[PageSpeed] 22

On Feb 1, 9:57=A0am, "Mark Kubicki" <M...@TillotsonDesign.com> wrote:
> I have an series of actions that need to be executed from differnt types =
of
> controls on 2 different forms
> one control is an option group, the second is a combobox (limit to list =
=3D
> yes)
>
> the commands had already been moved to a sub, SetPresetOptions(frm as
> Access.form) <call SetPresetOptions(me) > , which is located in the same
> module as the option group (and can be moved to a differnet module if
> needed)
>
> the code reads something like this:
> =A0 =A0 Select Case optSetPresetOptions
> =A0 =A0 case =3D 1
> =A0 =A0 =A0 =A0 do something
> =A0 =A0 case =3D 2
> =A0 =A0 =A0 =A0 dosomething else
> =A0 =A0 case =3D ....
>
> How would I adjust the select code to also work with the combobox
>
> many thanks in advance,
> Mark

Basically the exact same, except you values could numeric or text,
depending on the value stored in the leftmost column in the combobox.
0
Piet
2/1/2010 7:43:52 PM
If the combo box has just a few possible selections you could nest an If
statement or a Select Case inside each Case of your existing statement.  If
there are many possible combo box selections I don't think there is a generic
answer.  It would depend on the type and value of the combo box selection,
and the action you would have performed.  If you could post some specifics it
may help.

Mark Kubicki wrote:
>I have an series of actions that need to be executed from differnt types of 
>controls on 2 different forms
>one control is an option group, the second is a combobox (limit to list = 
>yes)
>
>the commands had already been moved to a sub, SetPresetOptions(frm as 
>Access.form) <call SetPresetOptions(me) > , which is located in the same 
>module as the option group (and can be moved to a differnet module if 
>needed)
>
>the code reads something like this:
>    Select Case optSetPresetOptions
>    case = 1
>        do something
>    case = 2
>        dosomething else
>    case = ....
>
>How would I adjust the select code to also work with the combobox
>
>many thanks in advance,
>Mark

-- 
Message posted via http://www.accessmonster.com

0
BruceM
2/1/2010 8:06:17 PM
I may have been a bit ambiguous:

- it is the same subroutine that would be called from both controls
- both controls are linked to the same [field], however,
         ~ at the option group the vaules returned (1, 2, 3... ), are used 
to execute code that "updates" the value of the [field]
         ~ at the combobox, the row source is a table whose records are the 
same as the values which the option group used in its after update event
- so, in one case I seem to need to check for values like 1, 2, 3... and in 
the other values like: "1st draft", "preliminary", "final"...

Should  I  be executing the common code when the field value changes and not 
after the control supdate (?)

-m.
------------------------------------------------------------------------------------------------------------


"Piet Linden" <pietlinden@hotmail.com> wrote in message 
news:7f293321-5890-42e6-b55d-beac14ad2c15@b10g2000yqa.googlegroups.com...
On Feb 1, 9:57 am, "Mark Kubicki" <M...@TillotsonDesign.com> wrote:
> I have an series of actions that need to be executed from differnt types 
> of
> controls on 2 different forms
> one control is an option group, the second is a combobox (limit to list =
> yes)
>
> the commands had already been moved to a sub, SetPresetOptions(frm as
> Access.form) <call SetPresetOptions(me) > , which is located in the same
> module as the option group (and can be moved to a differnet module if
> needed)
>
> the code reads something like this:
> Select Case optSetPresetOptions
> case = 1
> do something
> case = 2
> dosomething else
> case = ....
>
> How would I adjust the select code to also work with the combobox
>
> many thanks in advance,
> Mark

Basically the exact same, except you values could numeric or text,
depending on the value stored in the leftmost column in the combobox. 


0
Mark
2/1/2010 8:19:58 PM
Mark -

You can nest Case statements if that is what you want to do:

    Select Case optSetPresetOptions
    case = 1
    	Select Case <ComboboxValue>
    	case = "value1"
        	do something
    	case = "value2"
        	dosomething else
    	case = ....

    case = 2
    	Select Case <ComboboxValue>
    	case = "value1"
        	do something
    	case = "value2"
        	dosomething else
    	case = ....

    case = ....

-- 
Daryl S


"Mark Kubicki" wrote:

> I have an series of actions that need to be executed from differnt types of 
> controls on 2 different forms
> one control is an option group, the second is a combobox (limit to list = 
> yes)
> 
> the commands had already been moved to a sub, SetPresetOptions(frm as 
> Access.form) <call SetPresetOptions(me) > , which is located in the same 
> module as the option group (and can be moved to a differnet module if 
> needed)
> 
> the code reads something like this:
>     Select Case optSetPresetOptions
>     case = 1
>         do something
>     case = 2
>         dosomething else
>     case = ....
> 
> How would I adjust the select code to also work with the combobox
> 
> many thanks in advance,
> Mark 
> 
> 
> .
> 
0
Utf
2/1/2010 8:26:07 PM
- the option group (frame) is named: frmPresetOption, and  has (6) choices 
(radio buttons) which are the same as the records in the table 
optPrintPresests, which is used as row source for the combo box.
- the table optPrintPresests has (6) records; the values of the 6 records 
are the same as the lables for the option buttons (and are text)
- the slected value is stored in a table: tbeFixtureSchedulePrintOptions, in 
its field [PresetTitle]

this is the beginning to the code behind the option group beforeupdate 
event:  (the predominance of it has been moved tothe subroutine...)

Private Sub frmPresetOption_BeforeUpdate(Cancel As Integer)
    With Me
      Set Db = CurrentDb()
        Dim rst As DAO.Recordset
        Set rst = Db.OpenRecordset("SELECT * FROM 
[tbeFixtureSchedulePrintOptions]")
        DoCmd.SetWarnings False

Select Case .frmPresetOption.Value
Case Is = 1 'first draft
    [PresetTitle] = "First Draft"

    'fixture identifier options
        .frmManufacturersName = 1
        With .chkInclCatalogNo
            .Enabled = False
            .Value = "no"
        End With
        With .chkInclAltMfrs
            .Enabled = False
            .Value = "no"
        End With

    'description options
        .chkShortDescription.Value = "no"
        .chkInclLocations = "yes"
        .chkSeeSketch = "no"
        ...


"BruceM via AccessMonster.com" <u54429@uwe> wrote in message 
news:a2ff43b0e2617@uwe...
> If the combo box has just a few possible selections you could nest an If
> statement or a Select Case inside each Case of your existing statement. 
> If
> there are many possible combo box selections I don't think there is a 
> generic
> answer.  It would depend on the type and value of the combo box selection,
> and the action you would have performed.  If you could post some specifics 
> it
> may help.
>
> Mark Kubicki wrote:
>>I have an series of actions that need to be executed from differnt types 
>>of
>>controls on 2 different forms
>>one control is an option group, the second is a combobox (limit to list =
>>yes)
>>
>>the commands had already been moved to a sub, SetPresetOptions(frm as
>>Access.form) <call SetPresetOptions(me) > , which is located in the same
>>module as the option group (and can be moved to a differnet module if
>>needed)
>>
>>the code reads something like this:
>>    Select Case optSetPresetOptions
>>    case = 1
>>        do something
>>    case = 2
>>        dosomething else
>>    case = ....
>>
>>How would I adjust the select code to also work with the combobox
>>
>>many thanks in advance,
>>Mark
>
> -- 
> Message posted via http://www.accessmonster.com
> 


0
Mark
2/1/2010 8:59:12 PM
The code needs to be in the After Update event.  Before Update the selected
value has not been applied.  Also, you do not show variable declaration for
db, which should be DAO.Database.  However, I'm not sure why you are opening
a recordset at all.  Is the form bound to a different recordset than the one
specified in the Set rst line of code?

Is the Option Group bound?  I ask because from your description it sounds as
if the Option Group value is repeated in [PresetTitle], and somehow mirrors
the combo box too.

The real difficulty here is I cannot understand what you are trying to do.
Does the code you posted do part of what you need?  If so, what is it failing
to do?

Mark Kubicki wrote:
>- the option group (frame) is named: frmPresetOption, and  has (6) choices 
>(radio buttons) which are the same as the records in the table 
>optPrintPresests, which is used as row source for the combo box.
>- the table optPrintPresests has (6) records; the values of the 6 records 
>are the same as the lables for the option buttons (and are text)
>- the slected value is stored in a table: tbeFixtureSchedulePrintOptions, in 
>its field [PresetTitle]
>
>this is the beginning to the code behind the option group beforeupdate 
>event:  (the predominance of it has been moved tothe subroutine...)
>
>Private Sub frmPresetOption_BeforeUpdate(Cancel As Integer)
>    With Me
>      Set Db = CurrentDb()
>        Dim rst As DAO.Recordset
>        Set rst = Db.OpenRecordset("SELECT * FROM 
>[tbeFixtureSchedulePrintOptions]")
>        DoCmd.SetWarnings False
>
>Select Case .frmPresetOption.Value
>Case Is = 1 'first draft
>    [PresetTitle] = "First Draft"
>
>    'fixture identifier options
>        .frmManufacturersName = 1
>        With .chkInclCatalogNo
>            .Enabled = False
>            .Value = "no"
>        End With
>        With .chkInclAltMfrs
>            .Enabled = False
>            .Value = "no"
>        End With
>
>    'description options
>        .chkShortDescription.Value = "no"
>        .chkInclLocations = "yes"
>        .chkSeeSketch = "no"
>        ...
>
>> If the combo box has just a few possible selections you could nest an If
>> statement or a Select Case inside each Case of your existing statement. 
>[quoted text clipped - 29 lines]
>>>many thanks in advance,
>>>Mark

-- 
Message posted via http://www.accessmonster.com

0
BruceM
2/2/2010 12:45:52 PM
Reply:

Similar Artilces:

lookup link for customer address on account, case, address search
The way the address associations are handled today create tremendous gaps in the structure of CRM records compared to the structure of integrated backoffice financial systems records. What should be trivial integration tasks lead to a LOT of workarounds and customers frustration. Here is how we can improve. Abandon the idea of hardcoding first 2 address records on the account form. Add 2 address lookup fields on the account (relationships) that could be used to select any of the account addresses and expose them on the account form (still show individual address fields on the accoun...

Case 'Actual Duration' not getting updated in SQL
Knowledge Base article 913391: The "Actual Duration" field displays an incorrect value when you view the "Resolve Case" dialog box in Microsoft Dynamics CRM 3.0 This article corrects the time when you resolve a case by adding some script to an onsave event. Here is where it doesnt work: Lets say you go back and change the time from 2 hours to 4 hours on a Service Appointment. The form shows your updated time by running the onsave event but when you resolve the case, you original time displays and not the updated time. I looked in SQL and the ActualDuration and Sc...

grouping a chart in Access
I have a query that is 31 rows. I created a report that is grouped by Farm Name and House. The data shows correctly on each page for each Farm and House, but when I add a chart it gives me the data on the first page, but then gives me 30 pages of blank charts, till the next group. What did I miss? I am using Access 2010 beta. I expect the issue is with the section of the report containing the chart or the Link Master/Child properties of the chart control. -- Duane Hookom MS Access MVP "dstraub" <dstraub@discussions.microsoft.com> wrote in message new...

Run report on multi selected records.
I try to make a report for a custom entity that works like the Account Summary: let's say that it's Customer's Inquiry Summary for entity Customer's Inquiry I made the report so that I'm able to run the report on Customer's Inquiry Form. But when I select multi records in the list of Customer's Inquiry and run report, only one record is show in one page of the the report. I would like to have the selected records appear in the report with each record on each page. How can I do this? ...

Combo box list selection based on earlier selection by user
HI, I have a form that has a combo box 1 (Product) that reads a the Product table and has a unique id attached to each product (RO#). There is a second combo box 2 that is RO#. Now what I would like to do is when a user selects a Product in combo box 1, the system should lookup the Product selected from combo box 1 and upload the corresponding RO# in the combo box 2 list. Now I am using both combo boxes as Unbound and in the combo box 2 I have the two columns Product and RO# - in the Criteria row of RO# I have the following: Like IIf([Forms]![xa_f_lookup]![RO#]=" ",[Forms]![x...

Recovery Storage Group error when trying to add database
Running Exchange 2003, SP1, native mode on Windows 2003 I have created a recovery storage group, and when I right click on it to add the database to recover, I get the following error: The search filter cannot be recognized. Facility: Win32 ID no: 8007203e Exchange System Manager I have verified that AD has synced. Any ideas? Hi, The problem is that in the distinguished name of the database there is a single parenthesis without its match. Examples of this would include: cn=Mailbox Store 1 (SG1,cn=First Storage Group,.... cn=Mailbox Store 1 (SG2),cn=Second Storage Group (TestServer,cn...

Legal archiving for a group of users
I have a situation for legal reasons that i have to archive all communications for a group of users. I need to know how I can setup an Archive with either creating a seperate storage group for the users or installing some 3rd party solution. I've just never had a situation like this and need to know what my options are for doing such a task. Thanks in advance for anyone that might respond In article <00b801c3c006$571470c0$a301280a@phx.gbl>, "Linnie Gooch" <linniegooch@hotmail.com> wrote: > I have a situation for legal reasons that i have to > archive a...

When shading cells using the 'pattern' option, they print in grey.
When trying to print a 'pattern' in cell shading, it prints only as grey-scale solids. Do the patterns not print, or is it "averaging" the pattern into a solid? Printer dpi is 600, and appears as a pattern on Preview. ...

Can't select objects in Excel 2007
I'm trying to create a form in Excel 2007, and although I can manipulate, copy & paste controls (check boxes, etc) I can't select multiple objects to align them, etc. I've checked on-line help (and have followed the instructions), and other websites, but no one seems to have indicated a problem. It is extremely cumbersome and I need a solution. Any ideas? Thanks in advance, Jim Berglund I know this is about a year too late, but it may help others who have stumbled across this page looking for similar help. On the Home tab, in the Editing group, click Find & Select....

Lot Selection not Showing when I select PO on Receiving Entry
Usually, the Lot selection screen would pop up when I select a PO at the Line Detail of the Receivings Entry, now it does not! And GP will let items post without a lot number! It seems as if a setting has changed. Any ideas anyone? Any help is appreciated. Thanks, R Are you sure the item is marked to track lots? This wiould be set item by item on the Item Maintenance Options window. -- Richard L. Whaley Author / Consultant / MVP 2006-2008 Documentation for Software Users Get our Free Tips and Tricks Newsletter and check out our books at http://www.AccoladePublications.com &q...

Select contact then hangs
Hi, please help. I have a user that when she selects a contact using To: in a new email, after selecting 2, it closes outlook??. Spec is W2kSP4\office2k with all windows updates and office updates installed. Profile has been deleted and re-created, plus i have set up personal folders and moved contacts into there, and set that folder as a default, but makes no difference. Please help. ...

Add users to a Distribution Group using csv file
Is it possible? I have a list of approx 3200 users that I want to add to a common duistribution group w/o having to do it manually. At present I have a csv file with all the users that I want to be in the group. Is there a way to import them into the group using this file w/o recreating their accounts using csvde or ldife? TIA. Should be http://support.microsoft.com/?kbid=237677 http://www.computerperformance.co.uk/Logon/Logon_CSVDE_Bulk.htm Nue "kage13" <kage13@discussions.microsoft.com> wrote in message news:F8FB3846-DCDE-473F-9F1D-89E8CF0A66E3@microsoft.com... &...

Selecting rows from various sheets
Hi all, I have several sheets with a few columns in each. One colum in each sheet has a unique value. Most of these unique values are th same in each sheet but not all. Is there any way that I can set up new sheet that will have the unique value in column 1 and th corresponding column values frommeach sheet beside it. For example Sheet 1 aa 1 1 1 bb 2 2 2 cc 3 3 3 Sheet 2 aa 4 4 cc 5 5 Result aa 1 1 1 4 4 bb 2 2 2 cc 3 3 3 5 5 Thanks alot, Sha -- sha ----------------------------------------------------------------------- shav's Profile: http...

Edit Message option not available in Outlook
I recently received an email from a friend who had marked the email private and set importance to high. I replied to his message with no problem, my reply incorporating his original - and, it appears, keeping his security and importance settings, which didn't really matter to me. However, after sending my reply, I decided I wanted to edit it; and this is where I ran into problems. I double- click on the message in the list, then pick the Edit menu from the top of the screen . but the "edit message" option is not available. It is light gray and unpickable. This is maddeni...

Upgrade to IE8 should be Optional Update not Important till it wor
IE8 constantly crashes compared to IE7. Once you finally got IE7 to work you came out with IE8 which doesn't work. Why not have a version WORK properly rather than consantly creating new unworkable versions? I have had to downgrade to IE7 on all of my computers and now on Windows Uprade you are trying to FORCE me to uprade to IE8 by listing it as an IMPORTANT update when it is important to me to not have my browser crash constantly. It should be an OPTIONAL update only... because of this I have had to set my windows update files to NOT automatically install important ...

select text in Calendar
I'm working on a calendar in Publisher. I'm adding text into a cell by spacing down 1 point, then typing in 8 points. Doing fine until April. At that time, I can only select cells (whole days). It will not let me select the text. Help is no help. Any hints out there. Did I accidentally select something to do this? Bonnie Have you added a picture to the cell or a shape? If you have send it to the back, make the cell no fill and try again. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "GoBonnieGo" <GoB...

macro to filter data based on selected data
Hi, I am looking for a macro that requests input of a reference code and then a date and then filters the data in my spreadsheet based on this criteria. I am using excel 2007. Any help with this will be greatly appreciated. You can probably record a macro while doing it manually and then clean it up and add input boxes to ask the question or input your variable in a cell and use that. If all else fails, If desired, send your file to my address below. I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the ...

Can I send a message from a distribution group
One of our users belongs to a distribution group, and is trying to SEND a message using the Group address as the sender. Is this possible or does the sender address have to have a mailbox associated with it and not just an address (mailbox enabled rather than just mail enabled)? Thanks for your help "Midwest Muskie" <MidwestMuskie@discussions.microsoft.com> wrote in message news:85D00313-EC00-4266-9B54-7196B0C50D4D@microsoft.com... > One of our users belongs to a distribution group, and is trying to SEND a > message using the Group address as the sender. Is this ...

Link select with a blast
I have Win 7 Home Premium, x64. Quite often, when I select a link, a mouse pointer changes to a palm with a blast. I understand, the palm is the standard mouse pointer for link select, but what is the blast? What it indicates? -- Ilya Zeldes Fort Myers, Florida Hi Ilya, I suspect that this is being caused by a tracking program. Run something like Ad-Aware and see if it indicates a tracking company. If so, you can delete it, however, it might prevent you from accessing that particular website. Dave "Ilya Zeldes" wrote in message news:7A6FF9B1-5512-44...

Select Case in a Change Event
Hi, I am trying to use a worksheet Change Event to trap changes to specific columns. depending on which column is chnaged by the user, the value in another ciolumn will be altered; so, changes in either column O or P will update column Q, changes in either column T or U will update column V and changes in column Z or AA will update column AB. What I can't figure out is the Select Case bit (where I've got the shouted question below). Here's what I've put together, any comments would be much appreciated. Private Sub Worksheet_Change(ByVal Target As Range) ...

data validation vs combobox
hello there excel gurus.I am largely self taught in excel and can write straightforward macros and have a pretty good grasp of some of the functions.I have always used form comboboxes for my pull down lists.I notice that you seem to prefer the data validation list,pros and cons.?I like that the fom combo box is always there. -- paul remove nospam for email addy! Paul: There's bunches of companies who don't let their users run macros, for one. For another, Data Validation is, IMHO, much easier to show someone how to do. Comboboxes ALWAYS show their dropdown arrow. Comboboxes ar...

Select Records based another table...
This may be very elementary, but i can't wrap my brain around it. I have tried to dummy it down as much as i can for myself, with plans of adapting it into something working. I have three tables that look like the following: Tbl 1: ProdID A B C 1 $1 $2 $3 2 $4 $5 $6 3 $7 $8 $9 Tbl 2: RmNum ProdID 1 3 1 2 2 1 2 2 Tbl 3: RmNum Style 1 A 2 C Relationships are: [tbl1 ProdID] ------ [tbl2 ProdID] [tbl2 RmNum] ...

Forms Option control cell
How can I control the value of one cell (A15) based on which option was selected in an optionbox on a form? Thanks, You can use the Click event of each OptionButton, like the following: Private Sub OptionButton1_Click() If OptionButton1.Value Then Range("A15").Value = 1 End If End Sub Private Sub OptionButton2_Click() If OptionButton2.Value Then Range("A15").Value = 2 End If End Sub Private Sub OptionButton3_Click() If OptionButton3.Value Then Range("A15").Value = 3 End If End Sub Or, in a separate procedure S...

Calendar and Folder Sharing Using Groups
We are running Exchange 2000 in mixed mode and are trying to share calendars and folders using group permissions. In order to assign group permissions do these groups need to be global security groups? When we try to give permissions to a universal distribution group, using Outlook 2002 SP2, we get an error message "The modified permissions could not be saved. The client operation failed." I believe you'll need to be in native mode to do this. Note, however, that this would be best posted in m.p.exchange.admin as it isn't an Outlook issue. Jeff Martin wrote: > We are ...

Multi-Select List Box Does Not Retain Selected Items
I created an Outlook Form in 2003. But when I select items in the list box they do not remain select when I select another control on the form. Any suggestions? Did you bind the list box to a keywords field? -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "kaykay" <anonymous@discussions.microsoft.com> wrote in message news:276dd01c4638d$bd5af590$a501280a@phx.gbl... > I created an Outlook Form in 2003. But when I select > items i...