+ Reply to Thread
Results 1 to 5 of 5

Thread: MS Access - Case Statement Syntax

  1. #1
    Forum Contributor
    Join Date
    01-12-2004
    Location
    NY
    Posts
    92

    Unhappy MS Access - Case Statement Syntax

    I need your help once again.

    I have a query with two fields (Language and Team)
    I need a public function that will help me populate the Team field based on the Language field.
    For example if Language = "WO", then the function should return "Team1" for the Team field. If Language = "FR", then "Team2"... etc

    This is what I have so far:

    Public Function get_team(Lang) As String
    
         Select Case Lang
            Case "WO"
                get_team = "Team1"
                
            Case Else
                get_team = "LastTeam"
                            
        End Select
    End Function
    Obviously, this code does not work. But, I have no clue where to add what is missing... maybe a declaration or a formula to indicate the Team and Language fields in the argument.

    Thx in advance for any help provided
    _________________
    Regards,
    nrage21

  2. #2
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,155

    Re: MS Access - Case Statement Syntax

    Try
    
    Select Case Lang.value
    Alan

  3. #3
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,616

    Re: MS Access - Case Statement Syntax

    Your post does not comply with Rule 5 of our Forum RULES. We have Seven question forums: Miscellaneous, General, Programming, Worksheet Functions, Charting, Excel 2007 Help and New Users. Please choose the appropriate forum, and post your question in ONLY one forum.
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

  4. #4
    Forum Contributor
    Join Date
    01-12-2004
    Location
    NY
    Posts
    92

    Re: MS Access - Case Statement Syntax

    ??? I read rule #5... how did I violated the rule???? I didn't post this question is another forum and I did post it in the correct forum "Access Programming". Isn't a public function VBA code???
    _________________
    Regards,
    nrage21

  5. #5
    Valued Forum Contributor
    Join Date
    04-23-2009
    Location
    IOWA
    MS-Off Ver
    2010 Professional
    Posts
    270

    Re: MS Access - Case Statement Syntax

    I have been holding out on posting on this because there was a post by RoyUK. I couldn't figure out why either tbh.

    I pm'd roy. Waiting for a response.
    Last edited by split_atom18; 12-10-2010 at 10:02 AM.
    "I am not a rocket scientist, I am a nuclear engineer." - Split_atom18
    If my advice has been helpful to you, then please help me by clicking on the "Star" and adding to my reputation, Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0