Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    To Case or Not to Case (Access 2003)

    Scenario: A numeric Function Code is entered into text box "txtGoToFunction"

    Theory: If the Function Code is a 3 or 4 or 30 it jumps to its appropriate Case and does its appropriate thing.

    Real Life: the Function Not Found message pops up every time immaterial as to the code entered.

    '==============================================
    Private Sub txtGoToFunction_AfterUpdate()
    Dim intButType As Integer
    Dim strMsgPrompt As String, strMsgTitle As String

    If ([txtGoToFunction] <> 3 Or [txtGoToFunction] <> 4) Or _
    ([txtGoToFunction] <> 30) Then
    strMsgPrompt = " Function Code selected" & vbCrLf & _
    " is not available on this Screen" & vbCrLf & _
    "Please select an appropriate one"
    strMsgTitle = " Function Code Unavailable"
    intButType = vbExclamation
    MsgBox strMsgPrompt, intButType, strMsgTitle
    Me.txtGoToFunction.SetFocus
    SendKeys "{Enter}"
    SendKeys "{Enter}"
    SendKeys "{Enter}"
    Else
    Me.Refresh
    End If
    Select Case Me.txtGoToFunction
    Case 3
    Me.cbo_F03_UserId.SetFocus
    Me.cbo_F03_UserId.Dropdown
    Me.cbo_F03_UserId = Null
    Case 4
    Me.cbo_F04_UserId.SetFocus
    Me.cbo_F04_UserId.Dropdown
    Me.cbo_F04_UserId = Null
    Case 30
    Me.cbo_F30_UserId.SetFocus
    Me.cbo_F30_UserId.Dropdown
    Me.cbo_F30_UserId = Null
    End Select
    End Sub

    As always, every little bit of information that will show me the light, is appreciated,

    Cheers <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Cheers,
    Andy

  2. #2
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: To Case or Not to Case (Access 2003)

    These should be 'And's instead of 'Or's

    ([txtGoToFunction] <> 3 Or [txtGoToFunction] <> 4) Or _
    ([txtGoToFunction] <> 30)

    If you enter a 4, you'll get a TRUE that your [txtGoToFunction]<>3 or <> 30 which would send you to you Function Not Found

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: To Case or Not to Case (Access 2003)

    Bless your little Connecticut Yankee heart! Worked bang on first time. Much appreciated.

    Cheers <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Cheers,
    Andy

Posting Permissions

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