I wrote the following code, it worked at first then it
stoped working I checked and rechecked and found that the
line <if dcount> is not processed even if the count of
patientname was more than one time. the code jumps to the
<Else> part. Any Idea? thanks
Lookup is a combo field used to search by patient name
patient name is a calculated field with expresion in it
([lastname] & ", " & [firstname]).
The code is as follows:
If DCount
("[PatientName]", "qryProgNotesMain", "[PatientName]="" &
me![LookUp] & """) > 1 Then
msgbox "This Patient has 2 Protocols ID
Please select the correct Patient ID that corresponeds
with the right protocol"
DoCmd.ApplyFilter "", "[patientname]="" &
Me![LookUp] & """
Me.FilterOn = True
LookUp = Null
Else
Me.FilterOn = False
DoCmd.GoToControl "PatientID"
DoCmd.FindRecord [LookUp].Column(1),
acEntire, False, acDown, False, , True
LookUp = Null
End If