Results 1 to 4 of 4
  1. #1
    FinChase is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2011
    Posts
    20

    Case Else

    I have a Select Case statement that populates a text box based on the user's selection from a list box. It works fine as long as the value selected is one listed specifically in the case statement. But several values require exactly the same formula, and rather than listing each of them out, I thought I could use Case Else to call this for all the ones that did not meet the criteria. When I do this, however, the value does not change. Here is my statement. What am I doing wrong?


    Code:
     
     
    Dim Formula As String
    Formula = lstNG_RetGrp.Value
    Select Case Formula
    Case "NENUA"
    txtFormO65 = "Form_O65([qryNG_Post65_Plan Options]![Monthly Full Cost]-([qryNG_Post65_RetCode]![Percentage]* [qryNG_Post65_Plan Options]![Monthly Full Cost])"
    Case "NENUB"
    txtFormO65 = "Form_O65([qryNG_Post65_Plan Options]![Monthly Full Cost]-([qryNG_Post65_RetCode]![Percentage]* [qryNG_Post65_Plan Options]![Monthly Full Cost])"
    Case "NENUC"
    txtFormO65 = "Form_O65([qryNG_Post65_Plan Options]![Monthly Full Cost]-([qryNG_Post65_RetCode]![Percentage]* [qryNG_Post65_Plan Options]![Monthly Full Cost])"
    Case "NYNUNO"
    txtFormO65 = "Form_O65([qryNG_Post65_Plan Options]![Monthly Full Cost]-([qryNG_Post65_RetCode]![Percentage]* [qryNG_Post65_Plan Options]![Monthly Full Cost])"
    Case "NYNUNN"
    txtFormO65 = "Form_O65([qryNG_Post65_Plan Options]![Monthly Full Cost])"
    Case Else
    RetCodeO65 = "Form_YOS_Base([qryNG_Post65_Plan Options]![Monthly Full Cost]*[qryNG_Post65_RetCode]![Percentage])"
    End Select

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Did you mean to have a different target in the Else?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    FinChase is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2011
    Posts
    20
    No, that was a mistake. I finally figured that out shortly after I posted this. I've been staring at this problem so long that I missed it.

    Thanks for answering

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. CASE STATEMENT or IF-ELSE-THEN? HELP
    By Shakenaw in forum Access
    Replies: 9
    Last Post: 06-08-2015, 11:24 AM
  2. if or case statement and how
    By Dannat in forum Queries
    Replies: 1
    Last Post: 01-31-2012, 10:35 AM
  3. Problem with Match case
    By accessnewb in forum Programming
    Replies: 2
    Last Post: 08-05-2011, 01:51 PM
  4. Print ONE particular case
    By lyndon.pace in forum Programming
    Replies: 2
    Last Post: 04-11-2011, 07:53 AM
  5. Use Case Scenarios
    By scott.weppler in forum Access
    Replies: 0
    Last Post: 05-31-2009, 12:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums