用下面这段代码试试:
Private Sub Command1_Click()
   Text1.Text = ""
   Text1.SetFocus
End SubPrivate Sub Form_Load()
   Command1.SetFocus
End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)
  If KeyAscii = 13 Then
     Command1.SetFocus
  End If
End Sub

解决方案 »

  1.   

    1、button1.default=true
    2、Private Sub button1_click()
           text1.text=""
           text1.setfocus
       end sub
      

  2.   

    第一个:
    Private Sub Command1_Click()  '一个Button按钮
     MsgBox "sf"
    End SubPrivate Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
      If Key = 13 Then
        Call Command1_Click
      End If
    End Sub在窗体上按下回车键相当于点击Command1按钮
      

  3.   

    Private Sub Command1_Click()
      Text1.Text = ""
      Text1.SetFocus
    End Sub
      

  4.   

    第一个问题:
    private sub form_keypress(keyascii as integer)
    if keyascii=13 then
    command1_click
    end if
    end sub
    第二个问题:
    private sub command1_click
    text1.text=""
    text1.setfocus
    end sub
    其实这2者可以合成,实现当输完后按回车的效果:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
    text1.text=""
    text1.setfocus
    End Sub