Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Select Case (Access 2000)

    How or can i build a select case statement out of the following If Clause:

    If Nz(Me.cartons, 0) = 0 Then
    DoCmd.GoToControl " Quantity"
    else
    DoCmd.Beep
    End If

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Select Case (Access 2000)

    A Select Case statement is useful if you have many different options. Here you have only one If Then Else statement, so there is no need for a Select Case.

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select Case (Access 2000)

    i have several If statements and therefore i would like to use a Select case in order not to get confused.I have shown only one option but i have several option with If statements.
    The three if statements i have are very difficult to organize.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Select Case (Access 2000)

    You'll have to provide more information if you want help.

  5. #5
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Select Case (Access 2000)

    Thank you for your reply.You were right that i could have managed with one If statement.

  6. #6
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Select Case (Access 2000)

    The most typical use of Select Case is to test alternative values for a given variable (or expression, or whatever), but a nifty alternative is to use "Select Case True" and follow it with several Cases that may appear to have nothing to do with each other (i.e., may test completely different variables or conditions). Example:

    Select Case True
    Case x > 4
    ...
    Case y = 47
    ...
    Case ActiveDocument.Saved = False
    ...
    End Select

    Depending on the circumstances, this sometimes offers an elegant way to structure what would otherwise be a series of nested If tests.

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Select Case (Access 2000)

    Actually, the alternative structure would be a series of ElseIf statement, which is similar enough to the Select Case used like this that I see no particular benefit in using Select Case. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Charlotte

Posting Permissions

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