使用 NewRecord 属性可以确定当前记录是否为新记录。Integer 型,只读。
expression.NewRecord
expression 必需。返回“Applies To”列表中的一个对象的表达式。
Newrecord 属性使用以下设置:
| 设置 | 说明 | 
|---|---|
| True | 当前记录是新记录。 | 
| False | 当前记录不是新记录。 | 
只要用户移到新记录,不论其是否开始编辑新记录,NewRecord 属性都将设为 True。
下面的示例显示如何使用 NewRecord 属性来确定当前记录是否为新记录。NewRecordMark 过程将当前记录赋给变量 Intnewrec。如果该记录为新记录,则显示一个消息框通知用户。可以在窗体的 Current 事件发生时运行该过程。
Sub NewRecordMark(frm As Form)
    Dim intnewrec As Integer
    intnewrec = frm.NewRecord
    If intnewrec = True Then
    MsgBox "You're in a new record." _
        & "@Do you want to add new data?" _
        & "@If not, move to an existing record."
    End If
End Sub