Office中国论坛/Access中国论坛

标题: [求助]用Ctrl+Enter键跳到新记录 [打印本页]

作者: mayans    时间: 2006-4-23 03:47
标题: [求助]用Ctrl+Enter键跳到新记录
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Dim intCtrlDown As Integer
    intCtrlDown = (Shift And acCtrlMask) > 0
If intCtrlDown Then
     If KeyCode = 15 Then
     Me.Recordset.AddNew
     KeyCode = 0
     End If
End If
End Sub

这个代码为什么不行????

用下面这段代码,按Ctrl就可以直接跳到新记录

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Dim intCtrlDown As Integer
    intCtrlDown = (Shift And acCtrlMask) > 0
If intCtrlDown Then
     Me.Recordset.AddNew
End If
End Sub
作者: wuaza    时间: 2006-4-23 04:39
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If shift=2 and keycode=vbkeyenter Then
     Me.Recordset.AddNew
End If
End Sub




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3