在Text1的Keypress事件里填写你要处理的过程
Private Sub Text1_KeyPress(KeyAscii As Integer)
'判断按下的是回车键
if keyascii=13 then
'You Can
call Function..()
'you Can 
Do Anything..
end if
end sub

解决方案 »

  1.   

    窗体的keypreview=true
    在窗体的KEYDOWN事件中做判断:
    if keycode=vbkeyreturn then
       ...
    end if
      

  2.   

    Private Sub txtSerialNumber_KeyPress(KeyAscii As Integer)If (KeyAscii = 13) Then'按下回车键
    '调用你的过程或是按钮命令
    End IfEnd Sub
      

  3.   

    1、将command的Default属性设为ture。
    2、command的clock事件中调用 :)
      

  4.   

    调用 TEXT的KEYPRESS事件啊,很简单的,同意  iamluodong(嗨)  的
      

  5.   

    Private Sub Command1_Click()
        MsgBox "command1 is clicked!"
    End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)
        If KeyAscii = vbKeyReturn Then
            Call Command1_Click
        End If
    End SubPrivate Sub Text2_KeyPress(KeyAscii As Integer)
        If KeyAscii = vbKeyReturn Then
            Call sub1
        End If
    End SubPrivate Sub sub1()
        MsgBox "sub1 is called!"
    End Sub