Microsoft Access中 - 获取记录ID,当按钮被点击按钮、Microsoft、Access、ID

2023-09-08 11:23:39 作者:王晨正i

我使用的访问创建一个表单。

我想知道怎么我得到当我点击一个按钮,当前记录的ID。 我想Me.CurrentRecord在VB按钮code。但这个工作不能正常工作。 任何人都可以帮忙吗?

 私人小组save_record_Enter()

Me.CurrentRecord

结束小组
 

解决方案

您可以通过名字引用域基础记录和表单控件中的MS Access,例如:

  Me.ID
 MSGBOX Me.ID
 Me.txtID
 
易语言access 记录集.添加 为什么点两次按钮,数据库才被添加进第一条记录

I am using access to create a form.

i was wondering how to i get the current record id when i click a button. I tried "Me.CurrentRecord" in the vb button code. but this done not work. Can anyone help ?

Private Sub save_record_Enter()

Me.CurrentRecord

End Sub

解决方案

You can refer to fields in the underlying recordset and form controls in MS Access by name, for example:

 Me.ID
 MsgBox Me.ID
 Me.txtID