# Error in Forms

M

mccoy

I get a red # Error message that flashes in the upper right hand side of the
form.

the text within it reads:

=IIf(DCount("*","[Contacts Extended]","[ID]<>" & Nz([Clinic ID],0) & " And
[Contact Name] = '" & Replace(Nz([Contact Name]),"'","''") & "'")>0,"Possible
Duplicate","")

It also seems to be making things "unstable" i.e. screen freezes up etc.

Any help is greatly appreciated.
 
C

Clifford Bass

Hi,

Usually that means a function is choking on something. Or that a the
name of a variable or column is not spelled correctly. It may not make a
difference--modify the Nz([Contact Name]) to Nz([Contact Name],""). If that
does not help remove the code from the field for the time being and add a
button to your form and add an On Click event procedure to the button. In
the procedure do:

Dim lngCount As Long

On Error Resume Next

lngCount = DCount("*","[Contacts Extended]","[ID]<>" & Nz([Clinic ID],0) & "
And
[Contact Name] = '" & Replace(Nz([Contact Name], ""),"'","''") & "'")
If Err.Number = 0 Then
MsgBox "Count = " & lngCount & "."
Else
MsgBox "Error " & Err.Number & ": " & Err.Description & "."
Err.Clear
End if

Do a test on a record where the problem occurs. Click the button and
see what happens. Do you get a count or an error? If you get an error break
it down further by assigning parts of the formula to variables and adding in
more error checking and try again.

Clifford Bass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top