Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

適用對象

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

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×