適用對象
Form 物件 |
您可以使用 NewRecord 屬性來判斷 目前記錄 是否為新的記錄。 唯讀整數。
expression.NewRecord
運算式 必要。 傳回 [套用至] 清單中其中一個對象的表達式。
備註
NewRecord 屬性使用下列設定。
設定 |
描述 |
是 |
目前的記錄是新的。 |
False |
目前的記錄不是新的。 |
附註: NewRecord 屬性在 表單檢視和 資料工作表檢視中是唯讀的。 無法在 設計檢視中取得。 此屬性只能在使用巨集或 Visual Basic for Applications (VBA) 程式碼時取得。
當使用者移到新的記錄時,無論使用者是否已經開始編輯記錄,NewRecord 屬性設定都將為 True。
範例
下列範例示範如何使用 NewRecord 屬性來判斷目前的記錄是否為新的記錄。 NewRecordMark 程序會將目前的記錄設為變數 intnewrec。 如果是新記錄,則會顯示一個訊息,通知使用者這項資訊。 當表單發生目前的事件時,您可以執行這個程序。
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