我正在尝试使用dlookup从表单检查表中的isl值是否是抗性

问题描述 投票:0回答:1

我正在尝试在表中查找特定患者ID的值,并查看该患者是否具有“抗性”值。如果是这样,则禁用表单上的特定按钮。我尝试了以下dlookup,但它给了我编译器错误:

If DLookup("Rifampicin", "TableGeneXpert", "[PatientID] = " & Forms.FrmTreatment!PatientID) = Resistant Then
    Me.btnDSTMatch.Enabled = True
Else
    Me.btnDSTMatch.Enabled = False 
ms-access access-vba
1个回答
0
投票

尝试使用:

If DLookup("Rifampicin", "TableGeneXpert", "[PatientID] = " & Forms.FrmTreatment!PatientID & "") = "Resistant" Then
    Me.btnDSTMatch.Enabled = True
Else
    Me.btnDSTMatch.Enabled = False 
End If

或者也许直接:

Me.btnDSTMatch.Enabled = IsNull(DLookup("Rifampicin", "TableGeneXpert", "[PatientID] = " & Forms.FrmTreatment!PatientID & " And [Rifampicin] = 'Resistant'"))
© www.soinside.com 2019 - 2024. All rights reserved.