Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 来自查询访问的Msgbox_Vba_Ms Access - Fatal编程技术网

Vba 来自查询访问的Msgbox

Vba 来自查询访问的Msgbox,vba,ms-access,Vba,Ms Access,我有一个包含Id字段的访问表单。一旦用户输入Id,我想在更新后事件上运行查询,以获取“患者历史记录”字段并将其显示为消息框 查询如下: "Select Patients.[Patient History] From Patients Where Patients.ID = " & Me.PatientID 我该怎么做 谢谢您可以在一行程序中使用DLookup: MsgBox Nz(DLookup("[Patient History]", "Patients", "ID = " &

我有一个包含Id字段的访问表单。一旦用户输入Id,我想在更新后事件上运行查询,以获取“患者历史记录”字段并将其显示为消息框

查询如下:

"Select Patients.[Patient History] From Patients Where Patients.ID = " & Me.PatientID
我该怎么做

谢谢

您可以在一行程序中使用DLookup:

MsgBox Nz(DLookup("[Patient History]", "Patients", "ID = " & Me!PatientID.Value & "")), vbInformation + vbOkOnly, "Patient History"
请参见此问题和答案: