SetFocus

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve

    #1

    SetFocus

    I'm at my wits end here. Can someone tell me why this advances to the next
    field rather than stay in the pWord field.

    Thanks in Advance.
    Steve

    Private Sub pWord_AfterUpda te()
    If Forms![logon]![pWord] <> Forms![logon]![Secret] Then
    DoCmd.Beep
    MsgBox " That PASSWORD is not correct"
    Cancel = True
    Forms![logon]![pWord].SetFocus
    Forms![logon]![pWord] = Null

    Exit Sub

    End If


  • Arno R

    #2
    Re: SetFocus

    Steve,
    You better use the BeforeUpdate event which you can cancel indeed.

    --
    Hope this helps
    Arno R



    "Steve" <acrvpocf@netin s.net> schreef in bericht news:bo8sg0$9fs $1@ins22.netins .net...[color=blue]
    > I'm at my wits end here. Can someone tell me why this advances to the next
    > field rather than stay in the pWord field.
    >
    > Thanks in Advance.
    > Steve
    >
    > Private Sub pWord_AfterUpda te()
    > If Forms![logon]![pWord] <> Forms![logon]![Secret] Then
    > DoCmd.Beep
    > MsgBox " That PASSWORD is not correct"
    > Cancel = True
    > Forms![logon]![pWord].SetFocus
    > Forms![logon]![pWord] = Null
    >
    > Exit Sub
    >
    > End If
    >
    >[/color]



    Comment

    • Bradley

      #3
      Re: SetFocus

      Perhaps try setting it to Null before SetFocus ?

      And, yes, try the BeforeUpdate event.
      --
      Bradley
      Software Developer www.hrsystems.com.au
      A Christian Response www.pastornet.net.au/response

      "Steve" <acrvpocf@netin s.net> wrote in message
      news:bo8sg0$9fs $1@ins22.netins .net...[color=blue]
      > I'm at my wits end here. Can someone tell me why this advances to the next
      > field rather than stay in the pWord field.
      >
      > Thanks in Advance.
      > Steve
      >
      > Private Sub pWord_AfterUpda te()
      > If Forms![logon]![pWord] <> Forms![logon]![Secret] Then
      > DoCmd.Beep
      > MsgBox " That PASSWORD is not correct"
      > Cancel = True
      > Forms![logon]![pWord].SetFocus
      > Forms![logon]![pWord] = Null
      >
      > Exit Sub
      >
      > End If
      >
      >[/color]


      Comment

      Working...