Jump to content
Fórum Script Brasil
  • 0
Sign in to follow this  
Guest - Alepe -

Tecla Enter

Question

Guest - Alepe -

Pessoal a tecla enter é = a 13

Não estou localizando o camando que faz dispore um evento somente quando o ENTER for prescionado.

Private Sub txtcodprod_KeyPress(vbkeyenter As Integer)
Dim criterio, codigo As String

codigo = txtcodprod.Text

If codigo = Empty Then Exit Sub
criterio = "codigodoproduto ='" & codigo & "'"
rs3.MoveFirst
rs3.Find criterio, 0, adSearchForward


If rs3.EOF Then

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Costumo usar o evento KeyDown em vez do KeyPress:

Private Sub txtCodProd_KeyDown(KeyCode As Integer, Shift As Integer)
Dim criterio, codigo As String

If KeyCode = 13 Then Exit Sub 'Se não for enter, ele sai fora

codigo = txtcodprod.Text

If codigo = Empty Then Exit Sub
criterio = "codigodoproduto ='" & codigo & "'"
rs3.MoveFirst
rs3.Find criterio, 0, adSearchForward

Share this post


Link to post
Share on other sites
  • 0
Guest - Alepe -

Ele deixa somente digitar 2 letras e vai para checar o produto.

O codigo do produto tem 4 digitos.

Share this post


Link to post
Share on other sites
  • 0

Faz assim: somente após teclar o ENTER é que você chama a sua função:

Private Sub Text1_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then teste (Text1.Text)
End Sub

Sub teste(ByVal msg As String)
  MsgBox msg
End Sub

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  



  • Forum Statistics

    • Total Topics
      148121
    • Total Posts
      643415
×
×
  • Create New...