Results 1 to 2 of 2
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Check For Duplicate Check Before Posting.

    I have a scheduling form that may retain the record for a while until it is entered into the check registry. What is someone uses the check number assigned to the event when it was entered? I have a query to check for such a thing but wonder how I could run this before the event is entered and warnings and stop the event, etc...


    Since the query adds a where statement, I dont know how to address this as code. I have other code that will run If this and that and a append query as well, but dont want this to run if the check is a duplicate and if it is, then user corrects and rechecks. How can I put this as vba or what else can I do?
    This is the code from the dup check query.

    SELECT TReg.ChkNo, TReg.Bank
    FROM TReg
    WHERE (((TReg.ChkNo) In (SELECT [ChkNo] FROM [TReg] As Tmp GROUP BY [ChkNo] HAVING Count(*)>1 )))
    ORDER BY TReg.ChkNo;

  2. #2
    Amicron's Avatar
    Amicron is offline Access Guru
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Amherst, New York (near Buffalo)
    Posts
    31
    I know this is marked as SOLVED, but you can do this with a tiny bit of code in the AfterUpdate event of the field where the check number is entered:

    ID = NZ(DLOOKUP("CheckID","CheckTable","CheckNumber=" & CheckFieldOnForm))
    If ID <> 0 then
    msgbox "Check already in table"
    end if

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

Similar Threads

  1. How to check if there is duplicate entry
    By undee69 in forum Forms
    Replies: 8
    Last Post: 12-17-2012, 10:34 AM
  2. Replies: 3
    Last Post: 11-02-2012, 11:00 AM
  3. check text box after update for duplicate
    By smahdih in forum Access
    Replies: 1
    Last Post: 11-05-2011, 05:35 PM
  4. check for duplicate First and Last names?
    By newtoAccess in forum Access
    Replies: 3
    Last Post: 03-19-2011, 04:05 PM
  5. Replies: 0
    Last Post: 03-09-2011, 02:59 PM

Tags for this Thread

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