Running a Select Case procedure off a ComboBox Value

I am trying to Run a Select Case procedure off a combo box value. When one
value is chosen I want to open a query. When a different value is chosen, I
want to open another query. My Case Else is a message box that appears. What
happens is that when this procedure is executed, the message box appears,
regardless of what has been selected in the combo box... any ideas?

Thanks

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200710/1

0
Barkley
10/21/2007 4:48:29 PM
access.formscoding 7493 articles. 0 followers. Follow

5 Replies
1542 Views

Similar Articles

[PageSpeed] 55

Barkley via AccessMonster.com wrote:
> I am trying to Run a Select Case procedure off a combo box value.
> When one value is chosen I want to open a query. When a different
> value is chosen, I want to open another query. My Case Else is a
> message box that appears. What happens is that when this procedure is
> executed, the message box appears, regardless of what has been
> selected in the combo box... any ideas?
>
> Thanks

Is your ComboBox perhaps one that shows one value while displaying another?  It 
might not hold the values that you are testing for because they are not in the 
bound column.

-- 
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com 


0
Rick
10/21/2007 4:57:26 PM
In Design view the combo box says 'Unbound'... yet in Form view clicking on
the combobox reveals a list that I have in a table...

Rick Brandt wrote:
>> I am trying to Run a Select Case procedure off a combo box value.
>> When one value is chosen I want to open a query. When a different
>[quoted text clipped - 4 lines]
>>
>> Thanks
>
>Is your ComboBox perhaps one that shows one value while displaying another?  It 
>might not hold the values that you are testing for because they are not in the 
>bound column.
>

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200710/1

0
Barkley
10/21/2007 5:14:40 PM
Barkley via AccessMonster.com wrote:
> In Design view the combo box says 'Unbound'... yet in Form view
> clicking on the combobox reveals a list that I have in a table...

That is different.  "Unbound" where you saw it means that the ComboBox is not 
bound to a field in the underlying table or query that the form is bound to 
(assuming the form is even bound).

What you see in the drop down list is determined by the RowSource property of 
the ComboBox and if that RowSource includes multiple columns then ONE of them 
has to be chosen as the "bound column".  That is the column that the value of 
the ComboBox will take on when a selection is made.

For example, I could have a two column RowSource that contains CustomerID and 
CustomerName.  I could have the CustomerID column be the bound column with a 
width of zero so it does not show in the drop down list.  In that case the 
ComboBox will display the names of customers but it will always have the value 
of the chosen CustomerID.  In such a case my Select Case block would have to 
test for values of CustomerID, not of CustomerName.

-- 
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com



0
Rick
10/21/2007 5:27:41 PM
The form I created is unbound. Will that have an effect on my select case
procedure?

btw, thanks for the info on multiple columns in a combo box...

Rick Brandt wrote:
>> In Design view the combo box says 'Unbound'... yet in Form view
>> clicking on the combobox reveals a list that I have in a table...
>
>That is different.  "Unbound" where you saw it means that the ComboBox is not 
>bound to a field in the underlying table or query that the form is bound to 
>(assuming the form is even bound).
>
>What you see in the drop down list is determined by the RowSource property of 
>the ComboBox and if that RowSource includes multiple columns then ONE of them 
>has to be chosen as the "bound column".  That is the column that the value of 
>the ComboBox will take on when a selection is made.
>
>For example, I could have a two column RowSource that contains CustomerID and 
>CustomerName.  I could have the CustomerID column be the bound column with a 
>width of zero so it does not show in the drop down list.  In that case the 
>ComboBox will display the names of customers but it will always have the value 
>of the chosen CustomerID.  In such a case my Select Case block would have to 
>test for values of CustomerID, not of CustomerName.
>

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200710/1

0
Barkley
10/21/2007 5:37:21 PM
Barkley via AccessMonster.com wrote:
> The form I created is unbound. Will that have an effect on my select
> case procedure?

No.

-- 
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com



0
Rick
10/22/2007 11:15:09 AM
Reply:

Similar Artilces:

How to run Word macro in Excel macro
I am trying to run a Word macro in Excel macro. Could someone show me an sample? Thanks Kevin Kevin, Try something like the following Dim WD As Word.Application Dim Doc As Word.Document Set WD = New Word.Application With WD Set Doc = .Documents.Open("C:\doc1.doc") .Run "Doc1!TheMacro" Doc.Close savechanges:=False .Quit End With -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com chip@cpearson.com "Kevin" <anonymous@discussions.microsoft.com> wrote in message news:0dfe01c3a3b1$8515c0...

how do you remove a selected cell that is not saved on a clipboard
I need to know how to remove a selected cell that is not saved on a clipboard and cannot be posted elsewhere in a table Dee haskins, Are we talking about Access or Excel because Access has fields and you posted your question to the Microsoft Access newsgroup. Scroll a wee bit further down to get to the Excel newsgroup. -- Gina Whipp 2010 Microsoft MVP (Access) "I feel I have been denied critical, need to know, information!" - Tremors II http://www.regina-whipp.com/index_files/TipList.htm "Dee haskins" <Dee haskins@discussions.microsoft.com>...

Show data depending on value
I want to automatically populate the "Rates" from another worksheet. I tried the formula =IF(ROW(G50)<=COUNTIF('Working Data'!K:K,F50),INDEX('Working Data'! L:L,SMALL(IF('Working Data'!$K$6:$K$207=F50,ROW($A$6:$A $207)),ROW(G50))),"") but, the return value was blank. The value should have been .1465 I have this list in column F50:F54 and want the value to be retrieved from the Working Data worksheet from column L to column G50:G54. Country Currencies: Rates: China .1465 Hong Kong ...

Which rule clauses are case sensitive?
I define a rule that checks for a word in the Subject header. The rule can specify just the lowercase version of the word, say "word. When I send a test message to myself, it can have "word", "WORD", "Word" or other permutations and the rule will trigger on that message and perform whatever action was defined within it. That's good because I certainly do not want to create a list of multiple words or phrases to cover every possible capitalization of individual characters. However, I found that the clause "with <string> in the message header...

how can we sort data as we could do it in works? Select one colum.
MP, not sure of you question because I do not have works, but in excel, using the sort buttons on the too bar, if you have data in A:C and if you select column A only column A is sorted, if you select a cell in column A then A will sort but the data in B:C will be move with it. If this does not answer your question post back with more info. -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2000 & 2003 ** remove news from my email address to reply b...

Null in select list
I have never seen this format before: INSERT INTO #temp SELECT name, null [Title] FROM persons Is that the same as: INSERT INTO #temp SELECT name, CASE WHEN Title IS NULL THEN NULL ELSE Title END FROM persons Thanks, Tom Getting rid of dialect and guessing at the data element names, I think you meant: INSERT INTO Foobar (something_name, something_title) SELECT something_name, CAST (NULL AS <data type>) AS something_title FROM People; tshad No, in this case [Title] is just the column alias for the result set of the SELECT, which will become the c...

Pass Combo Box values to report
I have a form that passes criteria to a report. A combo box selects from a table with two fields code, description. Two questions 1. On selecting a code it would be nice to print the description for the code selected alongside the combo box in the form. 2. I can pass the code to the report, how can I pass on the description as well. Thanks CJ Create a query using your exising table and also the combo's RowSource table. This way you can add description field to the query grid. Then open your report in design view, and set its Record Source property to the name of the query. Since the...

Enter the cell value without leaving the cell
Is there a way to use the keyboard to enter a cell value without exiting the cell when you press the ENTER key? I use the mouse to click the green check mark in the formula bar, but I would prefer to use the keyboard to accomplish the same task. Thanks, CRTL - ENTER thanks "Chris Hedlund" <chedlund@mwdata.net> wrote in message news:eH3DAXMEGHA.1088@tk2msftngp13.phx.gbl... > Is there a way to use the keyboard to enter a cell value without exiting > the cell when you press the ENTER key? I use the mouse to click the green > check mark in the formula bar, bu...

Making fields conditionally dependant on the values of other fields?
I am working on an order-entry form for my users, and need to make the value of some fields conditionally dependant on the values of others. For example, if FieldA = "NONE" then I need FieldB to have one value. If FieldA = "YES" and FieldC = "OUT" then I need FieldB to have a different value, and so on. What is the best method for achieving this in Access 2000? It can't be done through tables. You could probably accomplish it on a form, using VBA, or else as computed fields in a query. Note that if you have rules defined as that, then you should NOT be ...

Run-time error '429' ActiveX component can't create object
Hi I have an application running in Access 2003 that is trying to open a second Access application and get the following error Run-time error '429' ActiveX component can't create object The references all seem OK - I have references to Visual Basic for Applications MS Access 10.0 Object Library MS DAO 3.6 Object Library MS ACtiveX Data Objects 2.1 Library OLE Automation My code is as follows Dim acApp As Access.Application Dim strDBPath As String strDBPath = "C:\NewAppName.mdb" Set acApp = New Access.Application With acApp ..OpenCurrentDatabase strDBPath ..DoCmd.O...

Autofilter by Combo Box Selection
I am looking to autofilter a worksheet to show the items that do not equal the selection in a conbo box. Does anyone know the code to autofilter by 'does not equal' the combobox selection. Regards Rob M ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ The easiest way to see the code is to turn on the macro recorder (tools=>Macro=>Record a new macro) and perform the action manually. The turn it off and look at the code. I believe the criteria will use ...

Counting Distinct Values
I have three columns of data. Here's a subset: ZIP Cope Name County 42312 John Franklin 42342 John Franklin 43545 John Franklin 42343 Mary Franklin 43786 Mary Franklin 48988 Dave Fairfield 47676 Dave Fairfield 47623 Mary Fairfiled 43589 Joe Fairfield 45646 Mike Fairfeld I need a formula to count the number of people per cou...

Running sum in query
I am using a query that sellects transactions by vendor... there are two fields [Credits] and [Debits] These are sorted by date... I would like to have and expression that makes a running total of these two fields.. I would then like to us this expression in a report.. Thanks in Advance for your help Bob http://tinyurl.com/2r8z4w "Bob" <Bob@discussions.microsoft.com> wrote in message news:E78171A3-F215-423E-BF06-63D22822896F@microsoft.com... >I am using a query that sellects transactions by vendor... there are two > fields [Credits] and [Debits] These are sorted...

Stop next cell being selected on Enter
I have a sheet which has only 3 input cells, but only one input cell is required for a user in a given state. I've disabled the "move selection after enter" function in tools/option/edit and when they enter a value and press enter the active cell stays the same - which is what I want. When I protect the sheet, the active cell jumps to the next unprotected cell. How can I stop it doing that? I don't know why Excel reacts this way, but when the worksheet is protected, make sure that the user is allowed to select both locked and unlocked cells. They still won't be abl...

paste values without copy-paste values
Can I replace the copy-paste values code with something like <range>.cells(i,j).value = <range>.cells(k,l).formula ? (or .text or .? or ....) I have a standard list with standard columns, and operational lists with subsets of columns. I also have an equivalence table between columns, to accomodate for titleswitching, missing columns and changes in the order. Now when I try a nested loop for rows and columns, applying a "<standardlistrange>.cells(i,j).formula = <operationalrange>.cells(i,k).value" formula to every cell, I get good results, ...

How to calculate the present value of a security, $5000 @ 7%, 20y.
I'm trying to use excell to calculate the present value of a security that will pay $5000.00 in 20 years at 7% interest. PV=FVn/(1+I)N There is a PV function in Excel. Have a look in the Excel built-in Help for more info on how to use the function. Regards, Tom "catslgc" wrote: > I'm trying to use excell to calculate the present value of a security that > will pay $5000.00 in 20 years at 7% interest. PV=FVn/(1+I)N ...

Qry values based on Cbo
I am trying to limit the data in my qry based on the values of a Combo box on a form. The trick to it is that if the Combo is left blank I would like it to return all records. Is this possible? I have tried the following but it does not work, Any help is appreciated. =IIf([Forms]![Frm_Clinical_EmployeeSelect]![Combo15]="","",=[Forms]![Frm_Clinical_EmployeeSelect]![Combo15]) Try this --- Like [Forms]![Frm_Clinical_EmployeeSelect]![Combo15] & "*" -- KARL DEWEY Build a little - Test a little "Jason" wrote: > I am trying to limit the ...

show select records in report
Shows every record: Private Sub Report_Open(Cancel As Integer) Dim stDocName As String Dim strInvoicing As String Dim strSites As String strInvoicing = "InvPercent" strSites = "Base List.Subform!SiteComplete" Shows one page of report but fields are blank.... Private Sub Report_Open(Cancel As Integer) Dim stDocName As String Dim strInvoicing As String Dim strSites As String strInvoicing = "InvPercent" strSites = "Base List.Subform!SiteComplete" stDocName = "Open Projects&...

muliple series selection
When selecting a series on a chart, the source cells become outlined the data in blue and the name in green. You can drag the borders t modify the data, including multiply cells for the name if you wish. This way source data can be easily modified with having to bring up th Source Data Dialog. I would like to be able to select all the char data in this manner so that all names and data sources are displayed a once. Alternately is there a way to look at all the code for a chart at once It would make massive alterations much easier. Thank -- Message posted from http://www.ExcelForum.com Ha...

Inserting items in table from selections in listbox
Hi, I have a listbox (list17) on a form based on a query called Projects_Select. The query has 6 fields which are displayed in the listbox as columns and not a set number of rows. The MultiSelect property is set to Extended. I have a command button (Command106) that on the OnClick event I want it to make a table in my database that contains the users selections from the listbox. I can't figure out how to do this since there are multiple columns in my listbox. Your help is much appreciated. Thanks! You will need to use the ItemsSelected collection of the list box to return the selec...

Select Words based on Specific Style
Hi MSWord Users: Word 2007 I have a long word document, which is a 10K (Annual Report) SEC Filing that I need to outline. The document in its current form does not have any structure or numbering or assigned headings. I want to simultaneously select all the words or sentences that are bold, italic, or contain the word “item”. Then paste onto a new document with existing format. I need to exclude any tables. Any help with a macro or wildcard find replace would be most useful. Thanks, Robb ...

Account for null values on a report
Hi - i have several reports that i am creating for users to input their required criteria - i.e. a report using query by form - they all work fine unless the criteria a user enters results in an empty query. the fields on the form are all summed or counted e.g. =Count([loanID]) to count the number of loans made, =Sum([amountloaned]) to show the total amount of money loaned. I am trying to account for the null values otherwise the fields on the report just show 'error'. I a trying to use the Nz function but am unsure if it will work on a field already using another function =...

any value of Cells in a Range of VB Spreadsheet control changed in
How to know whether any value of Cells in a Range of VB Spreadsheet control were changed after they were saved last time in VB6? the Dirty property can tell any changes after they were saved last time,even a cell was got focused or the spreadsheet is resized. But I just want to know whether the value of any cells in a Range were changed, instead of other changes like focusing on a cell or resize the spreadsheet Control. thanks! On 05/07/2010 11:47, sunlite wrote: > How to know whether any value of Cells in a Range of VB Spreadsheet control > were changed after th...

Excel 2007: Pivot tables "Invalid procedure call or argument"
Hi all I'm having problems with pivot tables and coding that worked fine in XL03 but is failing in XL07. My code fails when I attempt to set the CurrentPage. I can manually change the CurrentPage to the value that my code is attempting, and then the code works. I can manually change the CurrentPage back again to its original value and the code works again. It makes no sense why it's not working. The line of code failing is this: pt.PivotFields("Month").CurrentPage = CStr(12) Thanks in advance Paul Martin Melbourne, Australia ...

how can I change the value of Static Text in the dialog by the program?
how can I change the value of Static Text in the dialog by the program? zxch schrieb: > how can I change the value of Static Text in the dialog by the program? > > GetDlgItem(IDC_STATIC_TEXT)->SetWindowText(_T("New Text")); When you create the control, its name is IDC_STATIC. Change this to something useful, e.g, IDC_WHATEVER Then use ClassWizard to create a control member variable; you should end up with CStatic c_Whatever; in your .h file as a consequence. To change the text c_Whatever.SetWindowText(_T("Something")); Of course, the real string sh...