What am I doing wrong? 
Author Message
 What am I doing wrong?

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



Mon, 12 Jan 2004 23:13:50 GMT  
 What am I doing wrong?
Believe it or not, not enough quotes

If DCount _
("[PatientName]", "qryProgNotesMain", "[PatientName]=""" & _
   me![LookUp] & """") > 1 Then

Quote:

> 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



Tue, 13 Jan 2004 01:27:04 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Recordset: What am I doing wrong?

2. What am I doing wrong??

3. What am I doing wrong?

4. Help with syntax. What am I doing wrong

5. What am I doing wrong?

6. What am I doing wrong?

7. What am I doing wrong? -MultiSelect List box

8. Select Case - What am I doing wrong?

9. What am I doing wrong (easy).

10. OLE problem, or what am I doing wrong?

11. What am I doing wrong?

12. Footer/Page # - What am I doing wrong?

 

 
Powered by phpBB® Forum Software