Results 1 to 3 of 3
  1. #1
    dniezby is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Apr 2013
    Posts
    183

    Error keeps flashing

    Could someone look at this and help me understand what is going on?



    I'm modifying the template "Tasks" and on the Contact Details page there is a TextBox with this code in it.

    Code:
    =IIf(DCount("*","[Contacts Extended]","[ID]<>" & Nz([ID],0) & " And [Contact Name] = '" & Replace(Nz([Contact Name]),"'","''") & "'")>0,"Possible Duplicate","")
    When the form is loaded in live or layout view, it just blinks red and says Error...? I can't fined any references to these fields that might cause this issue.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    you cant replace in an IF.
    Run an update query, put the 'if' in the criteria to make your replace.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Actually, you can use the Replace function is an IIF() function.

    I don't understand your criteria, but this does not error for me:
    Code:
    =IIf(DCount("*","[Contacts Extended]","[ID]<>" & Nz([ID],0) & " And [Contact Name] = '" & Replace(Nz([Contact Name],""),"'","''") & "'")>0,"Possible Duplicate","")
    What is "ID"? Usually a field named "ID" is a PK field which is unique. There would only be 1 record.
    And why are you using "<>" (not equal to)????? To find "Possible Duplicate", I would think you would want to use "=" (equals).

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Flashing label
    By FJM in forum Access
    Replies: 45
    Last Post: 08-17-2016, 09:14 AM
  2. DLookUp Flashing Error
    By RawToast in forum Access
    Replies: 1
    Last Post: 12-16-2014, 09:02 AM
  3. Replies: 6
    Last Post: 12-30-2011, 01:07 PM
  4. Flashing textbox
    By coach32 in forum Forms
    Replies: 1
    Last Post: 11-22-2011, 02:22 AM
  5. subclassing a form to control flashing
    By swt1951swt in forum Forms
    Replies: 0
    Last Post: 07-14-2009, 05:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums